Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -31,13 +31,19 @@ def load_models():
|
|
31 |
try:
|
32 |
print("Loading CyberRealistic Pony models...")
|
33 |
|
34 |
-
#
|
35 |
-
print(f"
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
# Load Text2Img pipeline
|
38 |
if txt2img_pipe is None:
|
39 |
txt2img_pipe = StableDiffusionXLPipeline.from_single_file(
|
40 |
-
|
41 |
torch_dtype=torch.float16 if device == "cuda" else torch.float32,
|
42 |
use_safetensors=True,
|
43 |
variant="fp16" if device == "cuda" else None
|
|
|
31 |
try:
|
32 |
print("Loading CyberRealistic Pony models...")
|
33 |
|
34 |
+
# Download model file using huggingface_hub
|
35 |
+
print(f"Downloading model from {MODEL_REPO}...")
|
36 |
+
model_path = hf_hub_download(
|
37 |
+
repo_id=MODEL_REPO,
|
38 |
+
filename=MODEL_FILENAME,
|
39 |
+
cache_dir="/tmp/hf_cache" # Use tmp for Spaces
|
40 |
+
)
|
41 |
+
print(f"Model downloaded to: {model_path}")
|
42 |
|
43 |
# Load Text2Img pipeline
|
44 |
if txt2img_pipe is None:
|
45 |
txt2img_pipe = StableDiffusionXLPipeline.from_single_file(
|
46 |
+
model_path,
|
47 |
torch_dtype=torch.float16 if device == "cuda" else torch.float32,
|
48 |
use_safetensors=True,
|
49 |
variant="fp16" if device == "cuda" else None
|