Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,6 +19,29 @@ from PIL import Image
|
|
| 19 |
import io
|
| 20 |
import torch
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
URL="http://127.0.0.1"
|
| 24 |
OUTPUT_DIR="ComfyUI/output"
|
|
|
|
| 19 |
import io
|
| 20 |
import torch
|
| 21 |
|
| 22 |
+
from huggingface_hub import hf_hub_download
|
| 23 |
+
import os
|
| 24 |
+
|
| 25 |
+
# Define the repository and filename
|
| 26 |
+
repo_id = "oguzm/dreamshaper-xl-lightning-dpmsde"
|
| 27 |
+
filename = "dreamshaperXL_lightningDPMSDE.safetensors"
|
| 28 |
+
|
| 29 |
+
# Download the model
|
| 30 |
+
model_path = hf_hub_download(repo_id=repo_id, filename=filename)
|
| 31 |
+
|
| 32 |
+
# Ensure the checkpoints directory exists
|
| 33 |
+
checkpoints_dir = "ComfyUI/models/checkpoints"
|
| 34 |
+
os.makedirs(checkpoints_dir, exist_ok=True)
|
| 35 |
+
|
| 36 |
+
# Define the destination path
|
| 37 |
+
destination_path = os.path.join(checkpoints_dir, filename)
|
| 38 |
+
|
| 39 |
+
# Copy the model to the checkpoints directory if it doesn't already exist
|
| 40 |
+
if not os.path.exists(destination_path):
|
| 41 |
+
import shutil
|
| 42 |
+
shutil.copy(model_path, destination_path)
|
| 43 |
+
|
| 44 |
+
|
| 45 |
|
| 46 |
URL="http://127.0.0.1"
|
| 47 |
OUTPUT_DIR="ComfyUI/output"
|