update flux logic

This commit is contained in:
Karl Hudgell 2025-04-25 13:16:02 +01:00
parent 41fd1444eb
commit 073cc3bda2
2 changed files with 33 additions and 21 deletions

21
lib.py
View File

@ -249,10 +249,20 @@ def create_image(prompt: str | None = None) -> None:
"""Main function for generating images.""" """Main function for generating images."""
if prompt is None: if prompt is None:
prompt = create_prompt_on_openwebui(user_config["comfyui"]["prompt"]) prompt = create_prompt_on_openwebui(user_config["comfyui"]["prompt"])
if prompt:
logging.info(f"Generated prompt: {prompt}") # Log generated prompt if not prompt:
logging.error("No prompt generated.")
return
save_prompt(prompt) save_prompt(prompt)
if user_config["comfyui"]["FLUX"]:
use_flux = user_config["comfyui"].get("USE_FLUX", False)
only_flux = user_config["comfyui"].get("ONLY_FLUX", False)
selected_workflow = "SDXL"
if use_flux:
selected_workflow = "FLUX" if only_flux else random.choice(["FLUX", "SDXL"])
if selected_workflow == "FLUX":
generate_image( generate_image(
file_name="image", file_name="image",
comfy_prompt=prompt, comfy_prompt=prompt,
@ -267,9 +277,8 @@ def create_image(prompt: str | None = None) -> None:
) )
else: else:
generate_image("image", prompt) generate_image("image", prompt)
print(f"Image generation started with prompt: {prompt}")
else: logging.info(f"{selected_workflow} generation started with prompt: {prompt}")
logging.error("No prompt generated.")
def get_prompt_from_png(path): def get_prompt_from_png(path):

View File

@ -11,7 +11,10 @@ output_dir = ./output/
prompt = "Generate a random detailed prompt for stable diffusion." prompt = "Generate a random detailed prompt for stable diffusion."
width = 1568 width = 1568
height = 672 height = 672
FLUX = False topics =
USE_FLUX = False
ONLY_FLUX = False
[comfyui:flux] [comfyui:flux]
models = flux1-dev-Q4_0.gguf,flux1-schnell-Q4_0.gguf models = flux1-dev-Q4_0.gguf,flux1-schnell-Q4_0.gguf