-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated groq language model with vision and audio support. Renamed so…
…me scripts to match the node names. The old Groq API is removed, sorry.
- Loading branch information
1 parent
058f603
commit a4e717c
Showing
17 changed files
with
892 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
from .nodes.fetch_and_save_image import FetchAndSaveImage | ||
from .nodes.download_image_from_url import DownloadImageFromURL | ||
from .nodes.generate_negative_prompt import GenerateNegativePrompt | ||
from .nodes.groq_api_completion import GroqAPICompletion | ||
from .nodes.save_text_file import SaveTextFile | ||
from .nodes.get_file_path import GetFilePath | ||
from .nodes.groq_api_llm import GroqAPILLM | ||
from .nodes.groq_api_vlm import GroqAPIVLM | ||
from .nodes.groq_api_alm_transcribe import GroqAPIALMTranscribe | ||
#from .nodes.groq_api_alm_translate import GroqAPIALMTranslate | ||
|
||
|
||
NODE_CLASS_MAPPINGS = { | ||
"📁 Get File Path": GetFilePath, | ||
"💾 Save Text File With Path": SaveTextFile, | ||
"🖼️ Download Image from URL": FetchAndSaveImage, | ||
"✨ Groq LLM API": GroqAPICompletion, | ||
"🖼️ Download Image from URL": DownloadImageFromURL, | ||
"✨💬 Groq LLM API": GroqAPILLM, | ||
"✨📷 Groq VLM API": GroqAPIVLM, | ||
"✨📝 Groq ALM API - Transcribe": GroqAPIALMTranscribe, | ||
#"✨🌐 Groq ALM API - Translate [EN only]": GroqAPIALMTranslate, | ||
"⛔ Generate Negative Prompt": GenerateNegativePrompt, | ||
} | ||
|
||
print("\033[34mMNeMiC Nodes: \033[92mLoaded\033[0m") | ||
print("\033[34mMNeMiC Nodes: \033[92mLoaded\033[0m") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
from .fetch_and_save_image import FetchAndSaveImage | ||
from .download_image_from_url import DownloadImageFromURL | ||
from .generate_negative_prompt import GenerateNegativePrompt | ||
from .groq_api_completion import GroqAPICompletion | ||
from .save_text_file import SaveTextFile | ||
from .get_file_path import GetFilePath | ||
from .groq_api_llm import GroqAPILLM | ||
from .groq_api_vlm import GroqAPIVLM | ||
from .groq_api_alm_transcribe import GroqAPIALMTranscribe | ||
#from .groq_api_alm_translate import GroqAPIALMTranslate | ||
|
||
__all__ = [ | ||
"FetchAndSaveImage", | ||
"GenerateNegativePrompt", | ||
"GroqAPICompletion", | ||
"DownloadImageFromURL", | ||
"SaveTextFile", | ||
"GetFilePath", | ||
"GroqAPILLM", | ||
"GroqAPIVLM", | ||
"GroqAPIALMTranscribe", | ||
#"GroqAPIALMTranslate", | ||
"GenerateNegativePrompt", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import os | ||
from pathlib import Path | ||
from aiohttp import web | ||
import folder_paths | ||
|
||
class GetFilePath: | ||
OUTPUT_NODE = True | ||
RETURN_TYPES = ("STRING", "STRING", "STRING", "STRING") | ||
RETURN_NAMES = ("full_file_path", "file_path_only", "file_name_only", "file_extension_only") | ||
OUTPUT_TOOLTIPS = ("The full path to the file", "The path to the file", "The name of the file", "The extension of the file") | ||
FUNCTION = "get_file_path" | ||
CATEGORY = "⚡ MNeMiC Nodes" | ||
DESCRIPTION = "Gets a file path and returns components of the file path." | ||
DOCUMENTATION = "This is documentation" | ||
|
||
@classmethod | ||
def INPUT_TYPES(cls): | ||
input_dir = folder_paths.get_input_directory() | ||
files = [f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f))] | ||
return { | ||
"required": { | ||
"file": (sorted(files), {"file_upload": True, "tooltip": "Place your files in the 'input'-folder inside ComfyUI.\n\nBrowsing functionality is not yet supported. Please send help!"}), | ||
} | ||
} | ||
|
||
def get_file_path(self, file): | ||
try: | ||
# Handle file upload within the node logic | ||
uploaded_file_path = self.upload_file(file) | ||
|
||
# Resolve the full file path using folder_paths | ||
full_file_path = Path(uploaded_file_path) | ||
|
||
# Check if the file exists | ||
if not full_file_path.exists(): | ||
print(f"Error: File does not exist: {full_file_path}") | ||
return None, None, None, None | ||
|
||
# Extract file components | ||
file_path_only = str(full_file_path.parent) | ||
file_name_only = full_file_path.stem # File name without the extension | ||
file_extension_only = full_file_path.suffix # File extension | ||
|
||
# Return all as strings | ||
return ( | ||
str(full_file_path), # Full file path | ||
file_path_only, # Path only | ||
file_name_only, # File name without extension | ||
file_extension_only, # File extension | ||
) | ||
|
||
except Exception as e: | ||
# Handle any unexpected errors | ||
print(f"Error: Failed to process file path. Details: {str(e)}") | ||
return None, None, None, None | ||
|
||
def upload_file(self, file): | ||
try: | ||
# Define where to save uploaded files (e.g., input directory) | ||
input_dir = folder_paths.get_input_directory() | ||
file_path = os.path.join(input_dir, file) | ||
|
||
# Check if file already exists in the directory | ||
if os.path.exists(file_path): | ||
print(f"File {file} already exists in {input_dir}. Skipping upload.") | ||
return file_path | ||
|
||
# Mimic the upload logic | ||
with open(file_path, "wb") as f: | ||
# Here, you would write the file content to disk | ||
f.write(file) # Assuming `file` contains the file data | ||
|
||
print(f"File uploaded successfully: {file_path}") | ||
return file_path | ||
|
||
except Exception as e: | ||
print(f"Error uploading file: {str(e)}") | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[ | ||
{ | ||
"name": "Transcribe the song lyrics", | ||
"content": "" | ||
}, | ||
{ | ||
"name": "Transcribe meeting notes accurately", | ||
"content": "Write [INAUDIBLE] when unclear." | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[ | ||
{ | ||
"name": "Translate the audio file using the style and guidance of [user_input]", | ||
"content": "" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[ | ||
{ | ||
"name": "Describe the attached image following the [user_input] instruction", | ||
"content": "You are a vision-language model. Analyze the attached image and respond to the user request based on their query. If the query is empty, describe the image in a clear and descriptive manner." | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[ | ||
{ | ||
"name": "Add your own presets in UserPrompts.json", | ||
"content": "" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[ | ||
{ | ||
"name": "Add your own presets in UserPrompts.json", | ||
"content": "" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[ | ||
{ | ||
"name": "Add your own presets in UserPrompts.json", | ||
"content": "" | ||
} | ||
] |
Oops, something went wrong.