You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working with a script generated by the comfyui_to_python.py and am trying to modify the outputted script's functionality to accept dynamic prompts through command-line arguments. The goal is to make the script more flexible by allowing users to specify prompts at runtime, instead of having them hardcoded or predefined within the script (Actually trying to get it to work with LLM agent workflows).
Currently, the script either uses the hard coded prompt or (I assume) requires modification in the source code to change the prompt used in its operations.
Ideally, I would like the ability to pass a prompt directly when executing the script, something like this: python script_name.py "Custom prompt text here"
This would set the script to use the provided text as the prompt for its execution cycle.
Questions:
Is there existing functionality within the script or project that supports this, and I might have overlooked it?
If not, could you guide me on how best to implement this feature? Are there any considerations or best practices I should follow to maintain compatibility with the rest of the project?
Attempts:
I've tried modifying the script to parse command-line arguments using the sys.argv list, setting the first argument as the prompt variable. Here's a snippet of my current unsuccessful approach:
...
import sys
# Check for command-line arguments for the prompt
if len(sys.argv) > 1:
prompt = sys.argv[1]
else:
prompt = "beautiful scenery nature glass bottle yada yada yada"
...
cliptextencode = cliptextencode.encode(
text=prompt,
clip=get_value_at_index(checkpointloadersimple_4, 1),
)
I appreciate any guidance or suggestions you can provide. Thank you for your time and assistance.
The text was updated successfully, but these errors were encountered:
I have created a system that dynamically generates command-line arguments based on the inputs that are not fulfilled for any node in the ComfyUI workflow (i.e., any input [including widget inputs converted to piped inputs] that is required but not connected to a node will be interpreted as a command-line input).
Unfortunately, this repo has not been active in some time. My fork is here which implements this system.
Hello! Thanks so much for your work on this!
I'm working with a script generated by the comfyui_to_python.py and am trying to modify the outputted script's functionality to accept dynamic prompts through command-line arguments. The goal is to make the script more flexible by allowing users to specify prompts at runtime, instead of having them hardcoded or predefined within the script (Actually trying to get it to work with LLM agent workflows).
Currently, the script either uses the hard coded prompt or (I assume) requires modification in the source code to change the prompt used in its operations.
Ideally, I would like the ability to pass a prompt directly when executing the script, something like this:
python script_name.py "Custom prompt text here"
This would set the script to use the provided text as the prompt for its execution cycle.
Questions:
Attempts:
I've tried modifying the script to parse command-line arguments using the sys.argv list, setting the first argument as the prompt variable. Here's a snippet of my current unsuccessful approach:
I appreciate any guidance or suggestions you can provide. Thank you for your time and assistance.
The text was updated successfully, but these errors were encountered: