Lupara90 commited on
Commit
dffb4a8
·
verified ·
1 Parent(s): 6275165

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -39,7 +39,7 @@ if not os.path.exists(COMFYUI_DIR):
39
  CHECKPOINT_DIR = os.path.join(COMFYUI_DIR, "models", "checkpoints")
40
  os.makedirs(CHECKPOINT_DIR, exist_ok=True)
41
 
42
- # Download the exact model your workflow requires: epicphotogasm_ultimateFidelity
43
  model_filename = "epicphotogasm_ultimateFidelity.safetensors"
44
  model_path = os.path.join(CHECKPOINT_DIR, model_filename)
45
 
@@ -47,7 +47,7 @@ if not os.path.exists(model_path):
47
  print(f"Downloading {model_filename} (This may take a few minutes)...")
48
  # Public HuggingFace mirror for the EpicPhotogasm checkpoint
49
  model_url = "https://huggingface.co/sibylexpe/ModelsSD15/resolve/main/epicphotogasm_ultimateFidelity.safetensors"
50
- subprocess.run(["wget", "-O", model_path, model_url], check=True)
51
 
52
 
53
  # ==========================================
@@ -62,6 +62,10 @@ def generate_image(user_prompt):
62
  with open("workflow_api.json", "r") as f:
63
  prompt_workflow = json.load(f)
64
 
 
 
 
 
65
  # Inject your prompt into the correct CLIP Text Encode node ID (67)
66
  if "67" in prompt_workflow and "inputs" in prompt_workflow["67"]:
67
  prompt_workflow["67"]["inputs"]["text"] = user_prompt
@@ -87,7 +91,7 @@ def generate_image(user_prompt):
87
 
88
  # Poll local port until the server is alive
89
  server_ready = False
90
- for _ in range(20):
91
  time.sleep(1)
92
  try:
93
  with urllib.request.urlopen("http://127.0.0.1:8188/history", timeout=1) as r:
@@ -147,7 +151,11 @@ with gr.Blocks() as demo:
147
 
148
  with gr.Row():
149
  with gr.Column():
150
- prompt_input = gr.Textbox(label="Prompt", placeholder="A beautiful whimsical ink illustration...")
 
 
 
 
151
  submit_btn = gr.Button("Generate")
152
  with gr.Column():
153
  image_output = gr.Image(label="Result")
 
39
  CHECKPOINT_DIR = os.path.join(COMFYUI_DIR, "models", "checkpoints")
40
  os.makedirs(CHECKPOINT_DIR, exist_ok=True)
41
 
42
+ # Download the exact model your workflow requires
43
  model_filename = "epicphotogasm_ultimateFidelity.safetensors"
44
  model_path = os.path.join(CHECKPOINT_DIR, model_filename)
45
 
 
47
  print(f"Downloading {model_filename} (This may take a few minutes)...")
48
  # Public HuggingFace mirror for the EpicPhotogasm checkpoint
49
  model_url = "https://huggingface.co/sibylexpe/ModelsSD15/resolve/main/epicphotogasm_ultimateFidelity.safetensors"
50
+ subprocess.run(["wget", "-q", "-O", model_path, model_url], check=True)
51
 
52
 
53
  # ==========================================
 
62
  with open("workflow_api.json", "r") as f:
63
  prompt_workflow = json.load(f)
64
 
65
+ # Automatically patch the SD3 vs SD 1.5 Latent Mismatch
66
+ if "68" in prompt_workflow and prompt_workflow["68"].get("class_type") == "EmptySD3LatentImage":
67
+ prompt_workflow["68"]["class_type"] = "EmptyLatentImage"
68
+
69
  # Inject your prompt into the correct CLIP Text Encode node ID (67)
70
  if "67" in prompt_workflow and "inputs" in prompt_workflow["67"]:
71
  prompt_workflow["67"]["inputs"]["text"] = user_prompt
 
91
 
92
  # Poll local port until the server is alive
93
  server_ready = False
94
+ for _ in range(25):
95
  time.sleep(1)
96
  try:
97
  with urllib.request.urlopen("http://127.0.0.1:8188/history", timeout=1) as r:
 
151
 
152
  with gr.Row():
153
  with gr.Column():
154
+ prompt_input = gr.Textbox(
155
+ label="Prompt",
156
+ value="A 3D blocky rendering of a green creature in a tan robe and chest plate, dancing in a dedicated boombox setup. Bright colors, bold lines, blocky cel shading.",
157
+ lines=5
158
+ )
159
  submit_btn = gr.Button("Generate")
160
  with gr.Column():
161
  image_output = gr.Image(label="Result")