mirror of
https://github.com/karl0ss/ai_image_frame_server.git
synced 2025-04-28 19:23:41 +01:00
strange indent
This commit is contained in:
parent
db9b9610ab
commit
5ab4d76d4a
@ -85,5 +85,5 @@ if user_config["frame"]["auto_regen"] == "True":
|
|||||||
scheduler.start()
|
scheduler.start()
|
||||||
|
|
||||||
os.makedirs(image_folder, exist_ok=True)
|
os.makedirs(image_folder, exist_ok=True)
|
||||||
app.run(host="0.0.0.0", port=user_config["frame"]["port"], debug=True)
|
app.run(host="0.0.0.0", port=user_config["frame"]["port"], debug=True)
|
||||||
|
|
||||||
|
20
lib.py
20
lib.py
@ -77,9 +77,15 @@ def generate_image(file_name: str, comfy_prompt: str) -> None:
|
|||||||
api = ComfyApiWrapper(user_config["comfyui"]["comfyui_url"])
|
api = ComfyApiWrapper(user_config["comfyui"]["comfyui_url"])
|
||||||
wf = ComfyWorkflowWrapper("./workflow_api.json")
|
wf = ComfyWorkflowWrapper("./workflow_api.json")
|
||||||
# Set workflow parameters
|
# Set workflow parameters
|
||||||
wf.set_node_param("KSampler", "seed", random.getrandbits(32)) # Set a random seed for the sampler
|
wf.set_node_param(
|
||||||
wf.set_node_param("CLIP Text Encode (Prompt)", "text", comfy_prompt) # Set the prompt to be used for image generation
|
"KSampler", "seed", random.getrandbits(32)
|
||||||
wf.set_node_param("Save Image", "filename_prefix", file_name) # Set the filename prefix for the generated image
|
) # Set a random seed for the sampler
|
||||||
|
wf.set_node_param(
|
||||||
|
"CLIP Text Encode (Prompt)", "text", comfy_prompt
|
||||||
|
) # Set the prompt to be used for image generation
|
||||||
|
wf.set_node_param(
|
||||||
|
"Save Image", "filename_prefix", file_name
|
||||||
|
) # Set the filename prefix for the generated image
|
||||||
wf.set_node_param( # Set image dimensions
|
wf.set_node_param( # Set image dimensions
|
||||||
"Empty Latent Image", "width", user_config["comfyui"]["width"]
|
"Empty Latent Image", "width", user_config["comfyui"]["width"]
|
||||||
)
|
)
|
||||||
@ -94,10 +100,14 @@ def generate_image(file_name: str, comfy_prompt: str) -> None:
|
|||||||
if not valid_models:
|
if not valid_models:
|
||||||
raise Exception("No valid options available.")
|
raise Exception("No valid options available.")
|
||||||
model = random.choice(valid_models)
|
model = random.choice(valid_models)
|
||||||
wf.set_node_param("Load Checkpoint", "ckpt_name", model) # Set the model to be used for image generation
|
wf.set_node_param(
|
||||||
|
"Load Checkpoint", "ckpt_name", model
|
||||||
|
) # Set the model to be used for image generation
|
||||||
# Generate the image using the workflow and wait for completion
|
# Generate the image using the workflow and wait for completion
|
||||||
logging.debug(f"Generating image: {file_name}")
|
logging.debug(f"Generating image: {file_name}")
|
||||||
results = api.queue_and_wait_images(wf, "Save Image") # Queue the workflow and wait for image generation to complete
|
results = api.queue_and_wait_images(
|
||||||
|
wf, "Save Image"
|
||||||
|
) # Queue the workflow and wait for image generation to complete
|
||||||
rename_image() # Rename the generated image file if it exists
|
rename_image() # Rename the generated image file if it exists
|
||||||
# Save the generated image to disk
|
# Save the generated image to disk
|
||||||
for filename, image_data in results.items():
|
for filename, image_data in results.items():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user