Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,7 +28,7 @@ for package in required_packages:
|
|
| 28 |
subprocess.run([sys.executable, "-m", "pip", "install", package], check=True)
|
| 29 |
|
| 30 |
# ==========================================
|
| 31 |
-
# 2. Clone ComfyUI & Download
|
| 32 |
# ==========================================
|
| 33 |
COMFYUI_DIR = os.path.abspath("ComfyUI")
|
| 34 |
if not os.path.exists(COMFYUI_DIR):
|
|
@@ -39,14 +39,14 @@ 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 |
-
#
|
| 43 |
model_filename = "epicphotogasm_ultimateFidelity.safetensors"
|
| 44 |
model_path = os.path.join(CHECKPOINT_DIR, model_filename)
|
| 45 |
|
| 46 |
-
# Download the model if it doesn't exist
|
| 47 |
if not os.path.exists(model_path):
|
| 48 |
print(f"Downloading {model_filename} (This may take a few minutes)...")
|
| 49 |
-
|
|
|
|
| 50 |
subprocess.run(["wget", "-O", model_path, model_url], check=True)
|
| 51 |
|
| 52 |
|
|
@@ -62,9 +62,9 @@ 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
|
| 66 |
-
if "
|
| 67 |
-
prompt_workflow["
|
| 68 |
|
| 69 |
# Clear old remnants in both output and temp directories
|
| 70 |
search_dirs = [os.path.join(COMFYUI_DIR, "output"), os.path.join(COMFYUI_DIR, "temp")]
|
|
|
|
| 28 |
subprocess.run([sys.executable, "-m", "pip", "install", package], check=True)
|
| 29 |
|
| 30 |
# ==========================================
|
| 31 |
+
# 2. Clone ComfyUI & Download Custom Model
|
| 32 |
# ==========================================
|
| 33 |
COMFYUI_DIR = os.path.abspath("ComfyUI")
|
| 34 |
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 |
|
|
|
|
| 46 |
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 |
|
|
|
|
| 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
|
| 68 |
|
| 69 |
# Clear old remnants in both output and temp directories
|
| 70 |
search_dirs = [os.path.join(COMFYUI_DIR, "output"), os.path.join(COMFYUI_DIR, "temp")]
|