mirror of
https://github.com/karl0ss/ai_image_frame_server.git
synced 2025-08-12 20:58:28 +01:00
Compare commits
No commits in common. "main" and "0.2.19" have entirely different histories.
@ -1,5 +1,5 @@
|
||||
[tool.bumpversion]
|
||||
current_version = "0.3.8"
|
||||
current_version = "0.2.19"
|
||||
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
||||
serialize = ["{major}.{minor}.{patch}"]
|
||||
replace = "{new_version}"
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,4 +11,3 @@ publish.sh
|
||||
test.py
|
||||
.vscode/launch.json
|
||||
favourites.json
|
||||
.vscode/launch.json
|
||||
|
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -8,7 +8,7 @@
|
||||
"name": "Python Debugger: Current File",
|
||||
"type": "debugpy",
|
||||
"request": "launch",
|
||||
"program": "ai_frame_image_server.py",
|
||||
"program": "${file}",
|
||||
"console": "integratedTerminal",
|
||||
"justMyCode": false,
|
||||
"env": {"SECRET_KEY":"dkdkdk"}
|
||||
|
@ -4,7 +4,7 @@ FROM python:3.11-slim
|
||||
# Set the working directory in the container
|
||||
WORKDIR /app
|
||||
# Set version label
|
||||
ARG VERSION="0.3.8"
|
||||
ARG VERSION="0.2.19"
|
||||
LABEL version=$VERSION
|
||||
|
||||
# Copy project files into the container
|
||||
|
@ -18,13 +18,6 @@ user_config = load_config()
|
||||
app = Flask(__name__)
|
||||
app.secret_key = os.environ.get("SECRET_KEY")
|
||||
|
||||
# Make version available to all templates
|
||||
from libs.generic import get_current_version
|
||||
@app.context_processor
|
||||
def inject_version():
|
||||
version = get_current_version()
|
||||
return dict(version=version)
|
||||
|
||||
# Inject config into routes that need it
|
||||
create_routes.init_app(user_config)
|
||||
auth_routes.init_app(user_config)
|
||||
@ -46,16 +39,7 @@ from libs.comfyui import create_image
|
||||
|
||||
def scheduled_task():
|
||||
print(f"Executing scheduled task at {time.strftime('%Y-%m-%d %H:%M:%S')}")
|
||||
# Generate a random prompt using either OpenWebUI or OpenRouter
|
||||
from libs.generic import create_prompt_with_random_model
|
||||
prompt = create_prompt_with_random_model("Generate a random detailed prompt for stable diffusion.")
|
||||
if prompt:
|
||||
# Select a random model
|
||||
import random
|
||||
model = "Random Image Model"
|
||||
create_image(prompt, model)
|
||||
else:
|
||||
print("Failed to generate a prompt for the scheduled task.")
|
||||
create_image(None)
|
||||
|
||||
if user_config["frame"]["auto_regen"] == "True":
|
||||
if os.environ.get("WERKZEUG_RUN_MAIN") == "true":
|
||||
|
@ -15,7 +15,7 @@ from tenacity import (
|
||||
import nest_asyncio
|
||||
from libs.generic import rename_image, load_config, save_prompt
|
||||
from libs.create_thumbnail import generate_thumbnail
|
||||
from libs.openwebui import create_prompt_on_openwebui
|
||||
from libs.ollama import create_prompt_on_openwebui
|
||||
nest_asyncio.apply()
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
@ -122,20 +122,17 @@ def generate_image(
|
||||
def select_model(model: str) -> tuple[str, str]:
|
||||
use_flux = json.loads(user_config["comfyui"].get("FLUX", "false").lower())
|
||||
only_flux = json.loads(user_config["comfyui"].get("ONLY_FLUX", "false").lower())
|
||||
use_qwen = json.loads(user_config["comfyui"].get("Qwen", "false").lower())
|
||||
|
||||
if model == "Random Image Model":
|
||||
if model == "Random":
|
||||
selected_workflow = "FLUX" if (use_flux and (only_flux or random.choice([True, False]))) else "SDXL"
|
||||
elif "flux" in model.lower():
|
||||
selected_workflow = "FLUX"
|
||||
else:
|
||||
selected_workflow = "SDXL"
|
||||
|
||||
if model == "Random Image Model":
|
||||
if model == "Random":
|
||||
if selected_workflow == "FLUX":
|
||||
valid_models = user_config["comfyui:flux"]["models"].split(",")
|
||||
elif selected_workflow == "Qwen":
|
||||
valid_models = user_config["comfyui:qwen"]["models"].split(",")
|
||||
else: # SDXL
|
||||
available_model_list = user_config["comfyui"]["models"].split(",")
|
||||
valid_models = list(set(get_available_models()) & set(available_model_list))
|
||||
@ -144,16 +141,11 @@ def select_model(model: str) -> tuple[str, str]:
|
||||
return selected_workflow, model
|
||||
|
||||
|
||||
def create_image(prompt: str | None = None, model: str = "Random Image Model") -> None:
|
||||
def create_image(prompt: str | None = None, model: str = "Random") -> None:
|
||||
"""Generate an image with a chosen workflow (Random, FLUX*, or SDXL*)."""
|
||||
|
||||
if prompt is None:
|
||||
# Generate a random prompt using either OpenWebUI or OpenRouter
|
||||
from libs.generic import create_prompt_with_random_model
|
||||
prompt = create_prompt_with_random_model("Generate a random detailed prompt for stable diffusion.")
|
||||
if not prompt:
|
||||
logging.error("Failed to generate a prompt.")
|
||||
return
|
||||
prompt = create_prompt_on_openwebui(user_config["comfyui"]["prompt"])
|
||||
|
||||
if not prompt:
|
||||
logging.error("No prompt generated.")
|
||||
@ -161,7 +153,7 @@ def create_image(prompt: str | None = None, model: str = "Random Image Model") -
|
||||
|
||||
save_prompt(prompt)
|
||||
selected_workflow, model = select_model(model)
|
||||
|
||||
|
||||
if selected_workflow == "FLUX":
|
||||
generate_image(
|
||||
file_name="image",
|
||||
@ -176,86 +168,7 @@ def create_image(prompt: str | None = None, model: str = "Random Image Model") -
|
||||
model_param="unet_name",
|
||||
model=model
|
||||
)
|
||||
elif selected_workflow == "Qwen":
|
||||
generate_image(
|
||||
file_name="image",
|
||||
comfy_prompt=prompt,
|
||||
workflow_path="./workflow_qwen.json",
|
||||
prompt_node="Positive",
|
||||
seed_node="KSampler",
|
||||
seed_param="seed",
|
||||
save_node="Save Image",
|
||||
save_param="filename_prefix",
|
||||
model_node="Load Checkpoint",
|
||||
model_param="ckpt_name",
|
||||
model=model
|
||||
)
|
||||
else: # SDXL
|
||||
generate_image("image", comfy_prompt=prompt, model=model)
|
||||
|
||||
logging.info(f"{selected_workflow} generation started with prompt: {prompt}")
|
||||
|
||||
def get_queue_count() -> int:
|
||||
"""Fetches the current queue count from ComfyUI (pending + running jobs)."""
|
||||
url = user_config["comfyui"]["comfyui_url"] + "/queue"
|
||||
try:
|
||||
response = requests.get(url)
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
pending = len(data.get("queue_pending", []))
|
||||
running = len(data.get("queue_running", []))
|
||||
return pending + running
|
||||
except Exception as e:
|
||||
logging.error(f"Error fetching queue count: {e}")
|
||||
return 0
|
||||
|
||||
def get_queue_details() -> list:
|
||||
"""Fetches detailed queue information including model names and prompts."""
|
||||
url = user_config["comfyui"]["comfyui_url"] + "/queue"
|
||||
try:
|
||||
response = requests.get(url)
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
jobs = []
|
||||
for job_list in [data.get("queue_running", []), data.get("queue_pending", [])]:
|
||||
for job in job_list:
|
||||
# Extract prompt data (format: [priority, time, prompt])
|
||||
prompt_data = job[2]
|
||||
model = "Unknown"
|
||||
prompt = "No prompt"
|
||||
|
||||
# Find model loader node (works for SDXL/FLUX/Qwen workflows)
|
||||
for node in prompt_data.values():
|
||||
if node.get("class_type") in ["CheckpointLoaderSimple", "UnetLoaderGGUFAdvancedDisTorchMultiGPU"]:
|
||||
model = node["inputs"].get("ckpt_name", "Unknown")
|
||||
break
|
||||
|
||||
# Find prompt node using class_type pattern and title matching
|
||||
for node in prompt_data.values():
|
||||
class_type = node.get("class_type", "")
|
||||
if "CLIPTextEncode" in class_type and "text" in node["inputs"]:
|
||||
meta = node.get('_meta', {})
|
||||
title = meta.get('title', '').lower()
|
||||
if 'positive' in title or 'prompt' in title:
|
||||
prompt = node["inputs"]["text"]
|
||||
break
|
||||
|
||||
jobs.append({
|
||||
"id": job[0],
|
||||
"model": model.split(".")[0] if model != "Unknown" else model,
|
||||
"prompt": prompt
|
||||
})
|
||||
return jobs
|
||||
except Exception as e:
|
||||
logging.error(f"Error fetching queue details: {e}")
|
||||
return []
|
||||
try:
|
||||
response = requests.get(url)
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
pending = len(data.get("queue_pending", []))
|
||||
running = len(data.get("queue_running", []))
|
||||
return pending + running
|
||||
except Exception as e:
|
||||
logging.error(f"Error fetching queue count: {e}")
|
||||
return 0
|
||||
|
126
libs/generic.py
126
libs/generic.py
@ -4,7 +4,6 @@ import logging
|
||||
import sys
|
||||
import time
|
||||
import os
|
||||
import random
|
||||
from PIL import Image
|
||||
import nest_asyncio
|
||||
import json
|
||||
@ -110,31 +109,14 @@ def get_current_version():
|
||||
return version
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("Error running bump-my-version:", e)
|
||||
return "unknown"
|
||||
return None
|
||||
|
||||
def load_models_from_config():
|
||||
config = load_config()
|
||||
|
||||
# Only load FLUX models if FLUX feature is enabled
|
||||
use_flux = config["comfyui"].get("flux", "False").lower() == "true"
|
||||
if use_flux and "comfyui:flux" in config and "models" in config["comfyui:flux"]:
|
||||
flux_models = config["comfyui:flux"]["models"].split(",")
|
||||
else:
|
||||
flux_models = []
|
||||
|
||||
sdxl_models = config["comfyui"]["models"].split(",")
|
||||
|
||||
# Only load Qwen models if Qwen feature is enabled
|
||||
use_qwen = config["comfyui"].get("qwen", "False").lower() == "true"
|
||||
if use_qwen and "comfyui:qwen" in config and "models" in config["comfyui:qwen"]:
|
||||
qwen_models = config["comfyui:qwen"]["models"].split(",")
|
||||
else:
|
||||
qwen_models = []
|
||||
|
||||
flux_models = load_config()["comfyui:flux"]["models"].split(",")
|
||||
sdxl_models = load_config()["comfyui"]["models"].split(",")
|
||||
sorted_flux_models = sorted(flux_models, key=str.lower)
|
||||
sorted_sdxl_models = sorted(sdxl_models, key=str.lower)
|
||||
sorted_qwen_models = sorted(qwen_models, key=str.lower)
|
||||
return sorted_sdxl_models, sorted_flux_models, sorted_qwen_models
|
||||
return sorted_sdxl_models, sorted_flux_models
|
||||
|
||||
|
||||
def load_topics_from_config():
|
||||
@ -142,105 +124,5 @@ def load_topics_from_config():
|
||||
sorted_topics = sorted(topics, key=str.lower)
|
||||
return sorted_topics
|
||||
|
||||
def load_openrouter_models_from_config():
|
||||
config = load_config()
|
||||
if config["openrouter"].get("enabled", "False").lower() == "true":
|
||||
models = config["openrouter"]["models"].split(",")
|
||||
return sorted([model.strip() for model in models if model.strip()], key=str.lower)
|
||||
return []
|
||||
|
||||
def load_openwebui_models_from_config():
|
||||
config = load_config()
|
||||
if "openwebui" in config and "models" in config["openwebui"]:
|
||||
models = config["openwebui"]["models"].split(",")
|
||||
return sorted([model.strip() for model in models if model.strip()], key=str.lower)
|
||||
return []
|
||||
|
||||
def load_prompt_models_from_config():
|
||||
"""Load and return a list of available prompt generation models (both OpenWebUI and OpenRouter)."""
|
||||
config = load_config()
|
||||
prompt_models = []
|
||||
|
||||
# Add OpenWebUI models if configured
|
||||
if "openwebui" in config and "models" in config["openwebui"]:
|
||||
openwebui_models = config["openwebui"]["models"].split(",")
|
||||
prompt_models.extend([("openwebui", model.strip()) for model in openwebui_models if model.strip()])
|
||||
|
||||
# Add OpenRouter models if enabled and configured
|
||||
if config["openrouter"].get("enabled", "False").lower() == "true" and "models" in config["openrouter"]:
|
||||
openrouter_models = config["openrouter"]["models"].split(",")
|
||||
prompt_models.extend([("openrouter", model.strip()) for model in openrouter_models if model.strip()])
|
||||
|
||||
return prompt_models
|
||||
|
||||
|
||||
def create_prompt_with_random_model(base_prompt: str, topic: str = "random"):
|
||||
"""Create a prompt using a randomly selected model from OpenWebUI or OpenRouter.
|
||||
|
||||
If OpenWebUI fails, it will retry once. If it fails again, it will fallback to OpenRouter.
|
||||
"""
|
||||
prompt_models = load_prompt_models_from_config()
|
||||
|
||||
if not prompt_models:
|
||||
logging.warning("No prompt generation models configured.")
|
||||
return None
|
||||
|
||||
# Randomly select a model
|
||||
service, model = random.choice(prompt_models)
|
||||
|
||||
# Import here to avoid circular imports
|
||||
from libs.openwebui import create_prompt_on_openwebui
|
||||
from libs.openrouter import create_prompt_on_openrouter
|
||||
|
||||
if service == "openwebui":
|
||||
try:
|
||||
# First attempt with OpenWebUI
|
||||
logging.info(f"Attempting to generate prompt with OpenWebUI using model: {model}")
|
||||
result = create_prompt_on_openwebui(base_prompt, topic, model)
|
||||
if result:
|
||||
return result
|
||||
|
||||
# If first attempt returns None, try again
|
||||
logging.warning("First OpenWebUI attempt failed. Retrying...")
|
||||
result = create_prompt_on_openwebui(base_prompt, topic, model)
|
||||
if result:
|
||||
return result
|
||||
|
||||
# If second attempt fails, fallback to OpenRouter
|
||||
logging.warning("Second OpenWebUI attempt failed. Falling back to OpenRouter...")
|
||||
openrouter_models = [m for m in prompt_models if m[0] == "openrouter"]
|
||||
if openrouter_models:
|
||||
_, openrouter_model = random.choice(openrouter_models)
|
||||
return create_prompt_on_openrouter(base_prompt, topic, openrouter_model)
|
||||
else:
|
||||
logging.error("No OpenRouter models configured for fallback.")
|
||||
return "A colorful abstract composition" # Default fallback prompt
|
||||
|
||||
except Exception as e:
|
||||
logging.error(f"Error with OpenWebUI: {e}")
|
||||
# Fallback to OpenRouter on exception
|
||||
logging.warning("OpenWebUI exception. Falling back to OpenRouter...")
|
||||
openrouter_models = [m for m in prompt_models if m[0] == "openrouter"]
|
||||
if openrouter_models:
|
||||
_, openrouter_model = random.choice(openrouter_models)
|
||||
try:
|
||||
return create_prompt_on_openrouter(base_prompt, topic, openrouter_model)
|
||||
except Exception as e2:
|
||||
logging.error(f"Error with OpenRouter fallback: {e2}")
|
||||
return "A colorful abstract composition" # Default fallback prompt
|
||||
else:
|
||||
logging.error("No OpenRouter models configured for fallback.")
|
||||
return "A colorful abstract composition" # Default fallback prompt
|
||||
|
||||
elif service == "openrouter":
|
||||
try:
|
||||
# Use OpenRouter
|
||||
return create_prompt_on_openrouter(base_prompt, topic, model)
|
||||
except Exception as e:
|
||||
logging.error(f"Error with OpenRouter: {e}")
|
||||
return "A colorful abstract composition" # Default fallback prompt
|
||||
|
||||
return "A colorful abstract composition" # Default fallback prompt
|
||||
|
||||
user_config = load_config()
|
||||
output_folder = user_config["comfyui"]["output_dir"]
|
84
libs/ollama.py
Normal file
84
libs/ollama.py
Normal file
@ -0,0 +1,84 @@
|
||||
import random
|
||||
import logging
|
||||
import litellm
|
||||
import nest_asyncio
|
||||
from libs.generic import load_recent_prompts, load_config
|
||||
import re
|
||||
nest_asyncio.apply()
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
LOG_FILE = "./prompts_log.jsonl"
|
||||
|
||||
user_config = load_config()
|
||||
output_folder = user_config["comfyui"]["output_dir"]
|
||||
|
||||
def create_prompt_on_openwebui(prompt: str, topic: str = "random") -> str:
|
||||
"""Sends prompt to OpenWebui and returns the generated response."""
|
||||
topic_instruction = ""
|
||||
selected_topic = ""
|
||||
# Unique list of recent prompts
|
||||
recent_prompts = list(set(load_recent_prompts()))
|
||||
if topic == "random":
|
||||
topics = [t.strip() for t in user_config["comfyui"]["topics"].split(",") if t.strip()]
|
||||
selected_topic = random.choice(topics)
|
||||
elif topic != "":
|
||||
selected_topic = topic
|
||||
else:
|
||||
# Decide on whether to include a topic (e.g., 30% chance to include)
|
||||
topics = [t.strip() for t in user_config["comfyui"]["topics"].split(",") if t.strip()]
|
||||
if random.random() < 0.3 and topics:
|
||||
selected_topic = random.choice(topics)
|
||||
if selected_topic != "":
|
||||
topic_instruction = f" Incorporate the theme of '{selected_topic}' into the new prompt."
|
||||
|
||||
user_content = (
|
||||
"Can you generate me a really random image idea, Do not exceed 10 words. Use clear language, not poetic metaphors.”"
|
||||
+ topic_instruction
|
||||
+ "Avoid prompts similar to the following:"
|
||||
+ "\n".join(f"{i+1}. {p}" for i, p in enumerate(recent_prompts))
|
||||
)
|
||||
|
||||
|
||||
model = random.choice(user_config["openwebui"]["models"].split(","))
|
||||
response = litellm.completion(
|
||||
api_base=user_config["openwebui"]["base_url"],
|
||||
model="openai/" + model,
|
||||
messages=[
|
||||
{
|
||||
"role": "system",
|
||||
"content": (
|
||||
"You are a prompt generator for Stable Diffusion. "
|
||||
"Generate a detailed and imaginative prompt with a strong visual theme. "
|
||||
"Focus on lighting, atmosphere, and artistic style. "
|
||||
"Keep the prompt concise, no extra commentary or formatting."
|
||||
),
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": user_content,
|
||||
},
|
||||
],
|
||||
api_key=user_config["openwebui"]["api_key"],
|
||||
)
|
||||
|
||||
prompt = response["choices"][0]["message"]["content"].strip('"')
|
||||
# response = litellm.completion(
|
||||
# api_base=user_config["openwebui"]["base_url"],
|
||||
# model="openai/brxce/stable-diffusion-prompt-generator:latest",
|
||||
# messages=[
|
||||
# {
|
||||
# "role": "user",
|
||||
# "content": prompt,
|
||||
# },
|
||||
# ],
|
||||
# api_key=user_config["openwebui"]["api_key"],
|
||||
# )
|
||||
# prompt = response["choices"][0]["message"]["content"].strip('"')
|
||||
match = re.search(r'"([^"]+)"', prompt)
|
||||
if not match:
|
||||
match = re.search(r":\s*\n*\s*(.+)", prompt)
|
||||
if match:
|
||||
prompt = match.group(1)
|
||||
logging.debug(prompt)
|
||||
return prompt
|
@ -1,95 +0,0 @@
|
||||
import random
|
||||
import logging
|
||||
from openai import OpenAI
|
||||
import nest_asyncio
|
||||
from libs.generic import load_recent_prompts, load_config
|
||||
import re
|
||||
nest_asyncio.apply()
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
LOG_FILE = "./prompts_log.jsonl"
|
||||
|
||||
user_config = load_config()
|
||||
output_folder = user_config["comfyui"]["output_dir"]
|
||||
|
||||
def create_prompt_on_openrouter(prompt: str, topic: str = "random", model: str = None) -> str:
|
||||
"""Sends prompt to OpenRouter and returns the generated response."""
|
||||
# Check if OpenRouter is enabled
|
||||
if user_config["openrouter"].get("enabled", "False").lower() != "true":
|
||||
logging.warning("OpenRouter is not enabled in the configuration.")
|
||||
return ""
|
||||
|
||||
topic_instruction = ""
|
||||
selected_topic = ""
|
||||
# Unique list of recent prompts
|
||||
recent_prompts = list(set(load_recent_prompts()))
|
||||
if topic == "random":
|
||||
topics = [t.strip() for t in user_config["comfyui"]["topics"].split(",") if t.strip()]
|
||||
selected_topic = random.choice(topics) if topics else ""
|
||||
elif topic != "":
|
||||
selected_topic = topic
|
||||
else:
|
||||
# Decide on whether to include a topic (e.g., 30% chance to include)
|
||||
topics = [t.strip() for t in user_config["comfyui"]["topics"].split(",") if t.strip()]
|
||||
if random.random() < 0.3 and topics:
|
||||
selected_topic = random.choice(topics)
|
||||
if selected_topic != "":
|
||||
topic_instruction = f" Incorporate the theme of '{selected_topic}' into the new prompt."
|
||||
|
||||
user_content = (
|
||||
"Can you generate me a really random image idea, Do not exceed 10 words. Use clear language, not poetic metaphors."
|
||||
+ topic_instruction
|
||||
+ "Avoid prompts similar to the following:"
|
||||
+ "\n".join(f"{i+1}. {p}" for i, p in enumerate(recent_prompts))
|
||||
)
|
||||
|
||||
# Use the specified model or select a random model from the configured OpenRouter models
|
||||
if model:
|
||||
# Use the specified model
|
||||
model = model
|
||||
else:
|
||||
# Select a random model from the configured OpenRouter models
|
||||
models = [m.strip() for m in user_config["openrouter"]["models"].split(",") if m.strip()]
|
||||
if not models:
|
||||
logging.error("No OpenRouter models configured.")
|
||||
return ""
|
||||
|
||||
model = random.choice(models)
|
||||
|
||||
try:
|
||||
client = OpenAI(
|
||||
base_url="https://openrouter.ai/api/v1",
|
||||
api_key=user_config["openrouter"]["api_key"],
|
||||
)
|
||||
|
||||
completion = client.chat.completions.create(
|
||||
model=model,
|
||||
messages=[
|
||||
{
|
||||
"role": "system",
|
||||
"content": (
|
||||
"You are a prompt generator for Stable Diffusion. "
|
||||
"Generate a detailed and imaginative prompt with a strong visual theme. "
|
||||
"Focus on lighting, atmosphere, and artistic style. "
|
||||
"Keep the prompt concise, no extra commentary or formatting."
|
||||
),
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": user_content,
|
||||
},
|
||||
]
|
||||
)
|
||||
|
||||
prompt = completion.choices[0].message.content.strip('"')
|
||||
match = re.search(r'"([^"]+)"', prompt)
|
||||
if not match:
|
||||
match = re.search(r":\s*\n*\s*(.+)", prompt)
|
||||
if match:
|
||||
prompt = match.group(1)
|
||||
logging.debug(prompt)
|
||||
return prompt
|
||||
except Exception as e:
|
||||
logging.error(f"Error generating prompt with OpenRouter: {e}")
|
||||
return ""
|
@ -1,99 +0,0 @@
|
||||
import random
|
||||
import logging
|
||||
import nest_asyncio
|
||||
from libs.generic import load_recent_prompts, load_config
|
||||
import re
|
||||
from openwebui_chat_client import OpenWebUIClient
|
||||
from datetime import datetime
|
||||
|
||||
nest_asyncio.apply()
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
LOG_FILE = "./prompts_log.jsonl"
|
||||
|
||||
user_config = load_config()
|
||||
output_folder = user_config["comfyui"]["output_dir"]
|
||||
|
||||
def create_prompt_on_openwebui(prompt: str, topic: str = "random", model: str = None) -> str:
|
||||
"""Sends prompt to OpenWebui and returns the generated response."""
|
||||
topic_instruction = ""
|
||||
selected_topic = ""
|
||||
# Unique list of recent prompts
|
||||
recent_prompts = list(set(load_recent_prompts()))
|
||||
if topic == "random":
|
||||
topics = [t.strip() for t in user_config["comfyui"]["topics"].split(",") if t.strip()]
|
||||
selected_topic = random.choice(topics)
|
||||
elif topic != "":
|
||||
selected_topic = topic
|
||||
else:
|
||||
# Decide on whether to include a topic (e.g., 30% chance to include)
|
||||
topics = [t.strip() for t in user_config["comfyui"]["topics"].split(",") if t.strip()]
|
||||
if random.random() < 0.3 and topics:
|
||||
selected_topic = random.choice(topics)
|
||||
if selected_topic != "":
|
||||
topic_instruction = f" Incorporate the theme of '{selected_topic}' into the new prompt."
|
||||
|
||||
user_content = (
|
||||
"Can you generate me a really random image idea, Do not exceed 10 words. Use clear language, not poetic metaphors."
|
||||
+ topic_instruction
|
||||
+ "Avoid prompts similar to the following:"
|
||||
+ "\n".join(f"{i+1}. {p}" for i, p in enumerate(recent_prompts))
|
||||
)
|
||||
|
||||
if model:
|
||||
# Use the specified model
|
||||
model = model
|
||||
else:
|
||||
# Select a random model
|
||||
model = random.choice(user_config["openwebui"]["models"].split(",")).strip()
|
||||
|
||||
# Create OpenWebUI client
|
||||
client = OpenWebUIClient(
|
||||
base_url=user_config["openwebui"]["base_url"],
|
||||
token=user_config["openwebui"]["api_key"],
|
||||
default_model_id=model
|
||||
)
|
||||
|
||||
# Prepare messages for the chat
|
||||
messages = [
|
||||
{
|
||||
"role": "system",
|
||||
"content": (
|
||||
"You are a prompt generator for Stable Diffusion. "
|
||||
"Generate a detailed and imaginative prompt with a strong visual theme. "
|
||||
"Focus on lighting, atmosphere, and artistic style. "
|
||||
"Keep the prompt concise, no extra commentary or formatting."
|
||||
),
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": user_content,
|
||||
},
|
||||
]
|
||||
|
||||
# Send the chat request
|
||||
try:
|
||||
result = client.chat(
|
||||
question=user_content,
|
||||
chat_title=datetime.now().strftime("%Y-%m-%d %H:%M"),
|
||||
folder_name="ai-frame-image-server"
|
||||
)
|
||||
|
||||
if result:
|
||||
prompt = result["response"].strip('"')
|
||||
else:
|
||||
# Return None if the request fails
|
||||
logging.warning(f"OpenWebUI request failed with model: {model}")
|
||||
return None
|
||||
except Exception as e:
|
||||
logging.error(f"Error in OpenWebUI request with model {model}: {e}")
|
||||
return None
|
||||
|
||||
match = re.search(r'"([^"]+)"', prompt)
|
||||
if not match:
|
||||
match = re.search(r":\s*\n*\s*(.+)", prompt)
|
||||
if match:
|
||||
prompt = match.group(1)
|
||||
logging.debug(prompt)
|
||||
return prompt
|
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
@ -1,8 +1,8 @@
|
||||
from flask import Blueprint, request, render_template, redirect, url_for, session
|
||||
import threading
|
||||
from libs.comfyui import create_image, select_model, get_available_models, get_queue_count
|
||||
from libs.openwebui import create_prompt_on_openwebui
|
||||
from libs.generic import load_models_from_config, load_topics_from_config, load_openrouter_models_from_config, load_openwebui_models_from_config, create_prompt_with_random_model
|
||||
from libs.comfyui import create_image, select_model, get_available_models
|
||||
from libs.ollama import create_prompt_on_openwebui
|
||||
from libs.generic import load_models_from_config, load_topics_from_config
|
||||
import os
|
||||
|
||||
bp = Blueprint("create_routes", __name__)
|
||||
@ -12,73 +12,28 @@ user_config = None # will be set in init_app
|
||||
def create():
|
||||
if request.method == "POST":
|
||||
prompt = request.form.get("prompt")
|
||||
image_model = request.form.get("model") or "Random Image Model"
|
||||
selected_workflow, model = select_model(image_model)
|
||||
selected_workflow, model = select_model(request.form.get("model") or "Random")
|
||||
topic = request.form.get("topic")
|
||||
|
||||
if not prompt:
|
||||
# Get the prompt model from the form data
|
||||
prompt_model = request.form.get("prompt_model") or ""
|
||||
if prompt_model and prompt_model != "Random Prompt Model":
|
||||
# Use the specified prompt model
|
||||
service, service_model = prompt_model.split(":", 1) if ":" in prompt_model else (prompt_model, "")
|
||||
if service == "openwebui":
|
||||
from libs.openwebui import create_prompt_on_openwebui
|
||||
prompt = create_prompt_on_openwebui(user_config["comfyui"]["prompt"], topic, service_model)
|
||||
elif service == "openrouter":
|
||||
from libs.openrouter import create_prompt_on_openrouter
|
||||
prompt = create_prompt_on_openrouter(user_config["comfyui"]["prompt"], topic, service_model)
|
||||
else:
|
||||
# Use a random prompt model
|
||||
prompt = create_prompt_with_random_model(user_config["comfyui"]["prompt"], topic)
|
||||
prompt = create_prompt_on_openwebui(user_config["comfyui"]["prompt"], topic)
|
||||
|
||||
threading.Thread(target=lambda: create_image(prompt, model)).start()
|
||||
return redirect(url_for("create_routes.image_queued", prompt=prompt, model=model.split(".")[0]))
|
||||
|
||||
# Load all models (SDXL, FLUX, and Qwen)
|
||||
sdxl_models, flux_models, qwen_models = load_models_from_config()
|
||||
openwebui_models = load_openwebui_models_from_config()
|
||||
openrouter_models = load_openrouter_models_from_config()
|
||||
|
||||
queue_count = get_queue_count()
|
||||
return render_template("create_image.html",
|
||||
sdxx_models=sdxl_models,
|
||||
flux_models=flux_models,
|
||||
qwen_models=qwen_models,
|
||||
openwebui_models=openwebui_models,
|
||||
openrouter_models=openrouter_models,
|
||||
topics=load_topics_from_config(),
|
||||
queue_count=queue_count)
|
||||
return render_template("create_image.html", models=load_models_from_config()[0]+load_models_from_config()[1], topics=load_topics_from_config())
|
||||
|
||||
@bp.route("/image_queued")
|
||||
def image_queued():
|
||||
prompt = request.args.get("prompt", "No prompt provided.")
|
||||
model = request.args.get("model", "No model selected.")
|
||||
if model == "Random Image Model":
|
||||
model = "Random"
|
||||
else:
|
||||
model = model.split(".")[0]
|
||||
model = request.args.get("model", "No model selected.").split(".")[0]
|
||||
return render_template("image_queued.html", prompt=prompt, model=model)
|
||||
|
||||
@bp.route("/create_image", methods=["GET"])
|
||||
def create_image_page():
|
||||
if user_config["frame"]["create_requires_auth"] == "True" and not session.get("authenticated"):
|
||||
return redirect(url_for("auth_routes.login", next=request.path))
|
||||
|
||||
# Load all models (SDXL, FLUX, and Qwen)
|
||||
sdxl_models, flux_models, qwen_models = load_models_from_config()
|
||||
openwebui_models = load_openwebui_models_from_config()
|
||||
openrouter_models = load_openrouter_models_from_config()
|
||||
|
||||
queue_count = get_queue_count()
|
||||
return render_template("create_image.html",
|
||||
sdxl_models=sdxl_models,
|
||||
flux_models=flux_models,
|
||||
qwen_models=qwen_models,
|
||||
openwebui_models=openwebui_models,
|
||||
openrouter_models=openrouter_models,
|
||||
topics=load_topics_from_config(),
|
||||
queue_count=queue_count)
|
||||
return render_template("create_image.html", models=load_models_from_config()[0]+load_models_from_config()[1], topics=load_topics_from_config())
|
||||
|
||||
|
||||
def init_app(config):
|
||||
|
@ -11,10 +11,12 @@ def index():
|
||||
image_filename = "./image.png"
|
||||
image_path = os.path.join(image_folder, image_filename)
|
||||
prompt = get_details_from_png(image_path)["p"]
|
||||
version = get_current_version()
|
||||
|
||||
return render_template(
|
||||
"index.html",
|
||||
image=image_filename,
|
||||
prompt=prompt,
|
||||
reload_interval=user_config["frame"]["reload_interval"],
|
||||
version=version,
|
||||
)
|
||||
|
@ -1,12 +1,8 @@
|
||||
from flask import Blueprint, jsonify
|
||||
from libs.comfyui import cancel_current_job, get_queue_details
|
||||
from flask import Blueprint
|
||||
from libs.comfyui import cancel_current_job
|
||||
|
||||
bp = Blueprint("job_routes", __name__)
|
||||
|
||||
@bp.route("/cancel", methods=["GET"])
|
||||
def cancel_job():
|
||||
return cancel_current_job()
|
||||
|
||||
@bp.route("/api/queue", methods=["GET"])
|
||||
def api_queue():
|
||||
return jsonify(get_queue_details())
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
<!-- Version number at bottom right -->
|
||||
<div class="version">
|
||||
<a href="{{ url_for('settings_route.config_editor') }}">{% if version and version != 'unknown' %}v{{ version }}{% else %}v?.?.?{% endif %}</a>
|
||||
<a href="{{ url_for('settings_route.config_editor') }}">v{{ version }}</a>
|
||||
</div>
|
||||
|
||||
{% block scripts %}{% endblock %}
|
||||
|
@ -33,28 +33,6 @@
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.model-selection {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 20px;
|
||||
justify-content: center;
|
||||
margin: 20px 0;
|
||||
width: 100%;
|
||||
max-width: 800px;
|
||||
}
|
||||
|
||||
.model-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.model-group label {
|
||||
font-weight: bold;
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
button,
|
||||
select {
|
||||
background: #333;
|
||||
@ -65,7 +43,6 @@
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s;
|
||||
min-width: 150px;
|
||||
}
|
||||
|
||||
button:hover,
|
||||
@ -73,7 +50,6 @@
|
||||
background: #555;
|
||||
}
|
||||
|
||||
|
||||
#spinner-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
@ -114,15 +90,6 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.model-selection {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.model-group {
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
button,
|
||||
select {
|
||||
width: 100%;
|
||||
@ -132,138 +99,44 @@
|
||||
height: 150px;
|
||||
}
|
||||
}
|
||||
.queue-dropdown {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
right: 0;
|
||||
background: #222;
|
||||
border: 1px solid #444;
|
||||
border-radius: 5px;
|
||||
padding: 10px;
|
||||
z-index: 1001;
|
||||
display: none;
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
.queue-item {
|
||||
margin-bottom: 5px;
|
||||
padding: 5px;
|
||||
border-bottom: 1px solid #333;
|
||||
}
|
||||
|
||||
.queue-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.queue-item .prompt {
|
||||
font-size: 0.9em;
|
||||
color: #aaa;
|
||||
white-space: normal;
|
||||
word-wrap: break-word;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.queue-item .prompt:hover::after {
|
||||
content: "Model: " attr(data-model);
|
||||
position: absolute;
|
||||
bottom: 100%;
|
||||
left: 0;
|
||||
background: #333;
|
||||
color: #00aaff;
|
||||
padding: 4px 8px;
|
||||
border-radius: 4px;
|
||||
font-size: 0.8em;
|
||||
white-space: nowrap;
|
||||
z-index: 1002;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.3);
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="queue-container" style="position: fixed; top: 20px; right: 20px; z-index: 1000;">
|
||||
<button id="queue-btn" style="background: #333; color: white; border: none; padding: 5px 10px; border-radius: 5px; cursor: pointer;">
|
||||
Queue: <span id="queue-count">{{ queue_count | default(0) }}</span>
|
||||
</button>
|
||||
<div id="queue-dropdown" class="queue-dropdown">
|
||||
<!-- Queue items will be populated here -->
|
||||
</div>
|
||||
</div>
|
||||
<h1 style="margin-bottom: 20px;">Create An Image</h1>
|
||||
|
||||
<textarea id="prompt-box" placeholder="Enter your custom prompt here..."></textarea>
|
||||
|
||||
<div class="button-group">
|
||||
<button onclick="showSpinner(); location.href='/'">Back</button>
|
||||
<button onclick="sendPrompt()">Send Prompt</button>
|
||||
<button onclick="randomPrompt()">Random Prompt</button>
|
||||
</div>
|
||||
|
||||
<div class="model-selection">
|
||||
<div class="model-group">
|
||||
<label for="model-select">Image Model:</label>
|
||||
<select id="model-select">
|
||||
<option value="" selected>Random Image Model</option>
|
||||
{% if flux_models %}
|
||||
<optgroup label="FLUX">
|
||||
{% for m in flux_models %}
|
||||
<option value="{{ m }}">{{ m.rsplit('.', 1)[0] if '.' in m else m }}</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
{% endif %}
|
||||
{% if qwen_models %}
|
||||
<optgroup label="Qwen">
|
||||
{% for m in qwen_models %}
|
||||
<option value="{{ m }}">{{ m.rsplit('.', 1)[0] if '.' in m else m }}</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
{% endif %}
|
||||
{% if sdxl_models %}
|
||||
<optgroup label="SDXL">
|
||||
{% for m in sdxl_models %}
|
||||
<option value="{{ m }}">{{ m.rsplit('.', 1)[0] if '.' in m else m }}</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
{% endif %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="model-group">
|
||||
<label for="prompt-model-select">Prompt Model:</label>
|
||||
<select id="prompt-model-select">
|
||||
<option value="" selected>Random Prompt Model</option>
|
||||
{% if openwebui_models %}
|
||||
<optgroup label="OpenWebUI">
|
||||
{% for m in openwebui_models %}
|
||||
<option value="openwebui:{{ m }}">{{ m }}</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
{% endif %}
|
||||
{% if openrouter_models %}
|
||||
<optgroup label="OpenRouter">
|
||||
{% for m in openrouter_models %}
|
||||
<option value="openrouter:{{ m }}">{{ m }}</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
{% endif %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="model-group">
|
||||
<label for="topic-select">Topic:</label>
|
||||
<select id="topic-select">
|
||||
<option value="">No Topic</option>
|
||||
<option value="random">Random</option>
|
||||
<optgroup label="Topics">
|
||||
{% for t in topics %}
|
||||
<option value="{{ t }}">{{ t }}</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
<button onclick="sendPrompt()">Send Prompt</button>
|
||||
|
||||
<button onclick="randomPrompt()">Random Prompt</button>
|
||||
|
||||
<select id="model-select">
|
||||
<option value="" selected>Random</option>
|
||||
<optgroup label="FLUX">
|
||||
{% for m in models if 'flux' in m|lower %}
|
||||
<option value="{{ m }}">{{ m.rsplit('.', 1)[0] }}</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
<optgroup label="SDXL">
|
||||
{% for m in models if 'flux' not in m|lower %}
|
||||
<option value="{{ m }}">{{ m.rsplit('.', 1)[0] }}</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
</select>
|
||||
|
||||
<select id="topic-select">
|
||||
<option value="">No Topic</option>
|
||||
<option value="random">Random</option>
|
||||
<optgroup label="Topics">
|
||||
{% for t in topics %}
|
||||
<option value="{{ t }}">{{ t }}</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div id="spinner-overlay">
|
||||
@ -281,12 +154,10 @@
|
||||
showSpinner();
|
||||
const prompt = document.getElementById('prompt-box').value;
|
||||
const model = document.getElementById('model-select').value;
|
||||
const promptModel = document.getElementById('prompt-model-select').value;
|
||||
|
||||
const formData = new URLSearchParams();
|
||||
formData.append('prompt', prompt);
|
||||
formData.append('model', model);
|
||||
formData.append('prompt_model', promptModel);
|
||||
|
||||
fetch('/create', {
|
||||
method: 'POST',
|
||||
@ -305,12 +176,10 @@
|
||||
function randomPrompt() {
|
||||
showSpinner();
|
||||
const model = document.getElementById('model-select').value;
|
||||
const promptModel = document.getElementById('prompt-model-select').value;
|
||||
const topic = document.getElementById('topic-select').value;
|
||||
|
||||
const formData = new URLSearchParams();
|
||||
formData.append('model', model);
|
||||
formData.append('prompt_model', promptModel);
|
||||
formData.append('topic', topic);
|
||||
|
||||
fetch('/create', {
|
||||
@ -326,59 +195,5 @@
|
||||
alert("Error requesting random prompt: " + error);
|
||||
});
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const queueBtn = document.getElementById('queue-btn');
|
||||
const queueDropdown = document.getElementById('queue-dropdown');
|
||||
const queueCountSpan = document.getElementById('queue-count');
|
||||
|
||||
// Toggle dropdown visibility
|
||||
queueBtn.addEventListener('click', function(e) {
|
||||
e.stopPropagation();
|
||||
if (queueDropdown.style.display === 'block') {
|
||||
queueDropdown.style.display = 'none';
|
||||
} else {
|
||||
fetchQueueDetails();
|
||||
queueDropdown.style.display = 'block';
|
||||
}
|
||||
});
|
||||
|
||||
// Close dropdown when clicking outside
|
||||
document.addEventListener('click', function() {
|
||||
queueDropdown.style.display = 'none';
|
||||
});
|
||||
|
||||
// Prevent dropdown from closing when clicking inside it
|
||||
queueDropdown.addEventListener('click', function(e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
function fetchQueueDetails() {
|
||||
fetch('/api/queue')
|
||||
.then(response => response.json())
|
||||
.then(jobs => {
|
||||
queueCountSpan.textContent = jobs.length;
|
||||
const container = queueDropdown;
|
||||
container.innerHTML = '';
|
||||
|
||||
if (jobs.length === 0) {
|
||||
container.innerHTML = '<div class="queue-item">No jobs in queue</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
jobs.forEach(job => {
|
||||
const item = document.createElement('div');
|
||||
item.className = 'queue-item';
|
||||
item.innerHTML = `
|
||||
<div class="prompt" data-model="${job.model}">${job.prompt}</div>
|
||||
`;
|
||||
container.appendChild(item);
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error fetching queue:', error);
|
||||
queueDropdown.innerHTML = '<div class="queue-item">Error loading queue</div>';
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
@ -24,9 +24,4 @@ models = flux1-dev-Q4_0.gguf,flux1-schnell-Q4_0.gguf
|
||||
[openwebui]
|
||||
base_url = https://openwebui
|
||||
api_key = sk-
|
||||
models = llama3:latest,cogito:14b,gemma3:12b
|
||||
|
||||
[openrouter]
|
||||
enabled = False
|
||||
api_key =
|
||||
models = mistralai/mistral-7b-instruct:free,google/gemma-7b-it:free,meta-llama/llama-3.1-8b-instruct:free
|
||||
models = llama3:latest,cogito:14b,gemma3:12b
|
@ -1,147 +0,0 @@
|
||||
{
|
||||
"93": {
|
||||
"inputs": {
|
||||
"text": "jpeg compression",
|
||||
"speak_and_recognation": {
|
||||
"__value__": [
|
||||
false,
|
||||
true
|
||||
]
|
||||
},
|
||||
"clip": [
|
||||
"126",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "CLIPTextEncode",
|
||||
"_meta": {
|
||||
"title": "CLIP Text Encode (Prompt)"
|
||||
}
|
||||
},
|
||||
"95": {
|
||||
"inputs": {
|
||||
"seed": 22,
|
||||
"steps": 10,
|
||||
"cfg": 4.5,
|
||||
"sampler_name": "euler",
|
||||
"scheduler": "normal",
|
||||
"denoise": 1,
|
||||
"model": [
|
||||
"127",
|
||||
0
|
||||
],
|
||||
"positive": [
|
||||
"100",
|
||||
0
|
||||
],
|
||||
"negative": [
|
||||
"93",
|
||||
0
|
||||
],
|
||||
"latent_image": [
|
||||
"97",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "KSampler",
|
||||
"_meta": {
|
||||
"title": "KSampler"
|
||||
}
|
||||
},
|
||||
"97": {
|
||||
"inputs": {
|
||||
"width": 1280,
|
||||
"height": 768,
|
||||
"length": 1,
|
||||
"batch_size": 1
|
||||
},
|
||||
"class_type": "EmptyHunyuanLatentVideo",
|
||||
"_meta": {
|
||||
"title": "EmptyHunyuanLatentVideo"
|
||||
}
|
||||
},
|
||||
"98": {
|
||||
"inputs": {
|
||||
"samples": [
|
||||
"95",
|
||||
0
|
||||
],
|
||||
"vae": [
|
||||
"128",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "VAEDecode",
|
||||
"_meta": {
|
||||
"title": "VAE Decode"
|
||||
}
|
||||
},
|
||||
"100": {
|
||||
"inputs": {
|
||||
"text": "Terminator riding a push bike",
|
||||
"speak_and_recognation": {
|
||||
"__value__": [
|
||||
false,
|
||||
true
|
||||
]
|
||||
},
|
||||
"clip": [
|
||||
"126",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "CLIPTextEncode",
|
||||
"_meta": {
|
||||
"title": "CLIP Text Encode (Prompt)"
|
||||
}
|
||||
},
|
||||
"102": {
|
||||
"inputs": {
|
||||
"images": [
|
||||
"98",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "PreviewImage",
|
||||
"_meta": {
|
||||
"title": "Preview Image"
|
||||
}
|
||||
},
|
||||
"126": {
|
||||
"inputs": {
|
||||
"clip_name": "Qwen2.5-VL-7B-Instruct-Q3_K_M.gguf",
|
||||
"type": "qwen_image",
|
||||
"device": "cuda:1",
|
||||
"virtual_vram_gb": 6,
|
||||
"use_other_vram": true,
|
||||
"expert_mode_allocations": ""
|
||||
},
|
||||
"class_type": "CLIPLoaderGGUFDisTorchMultiGPU",
|
||||
"_meta": {
|
||||
"title": "CLIPLoaderGGUFDisTorchMultiGPU"
|
||||
}
|
||||
},
|
||||
"127": {
|
||||
"inputs": {
|
||||
"unet_name": "qwen-image-Q2_K.gguf",
|
||||
"device": "cuda:0",
|
||||
"virtual_vram_gb": 6,
|
||||
"use_other_vram": true,
|
||||
"expert_mode_allocations": ""
|
||||
},
|
||||
"class_type": "UnetLoaderGGUFDisTorchMultiGPU",
|
||||
"_meta": {
|
||||
"title": "UnetLoaderGGUFDisTorchMultiGPU"
|
||||
}
|
||||
},
|
||||
"128": {
|
||||
"inputs": {
|
||||
"vae_name": "qwen_image_vae.safetensors",
|
||||
"device": "cuda:1"
|
||||
},
|
||||
"class_type": "VAELoaderMultiGPU",
|
||||
"_meta": {
|
||||
"title": "VAELoaderMultiGPU"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user