Spaces:
Sleeping
Sleeping
saranbalan
commited on
Commit
•
1f5ca02
1
Parent(s):
df7ac0a
Update app.py
Browse files
app.py
CHANGED
@@ -18,14 +18,13 @@ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
|
18 |
whisper_model = whisper.load_model("base")
|
19 |
|
20 |
# Model IDs for Stable Diffusion pipelines
|
21 |
-
|
22 |
-
model_id2 = "stabilityai/stable-diffusion-xl-base-1.0"
|
23 |
|
24 |
# Initialize Stable Diffusion pipeline based on device
|
25 |
if torch.cuda.is_available():
|
26 |
-
pipe = StableDiffusionPipeline.from_pretrained(
|
27 |
else:
|
28 |
-
pipe = StableDiffusionPipeline.from_pretrained(
|
29 |
|
30 |
# Move model to the selected device (either GPU or CPU)
|
31 |
pipe = pipe.to(device)
|
|
|
18 |
whisper_model = whisper.load_model("base")
|
19 |
|
20 |
# Model IDs for Stable Diffusion pipelines
|
21 |
+
HF_API_KEY = https://huggingface.co/ByteDance/SDXL-Lightning/resolve/main/sdxl_lightning_1step_x0.safetensors
|
|
|
22 |
|
23 |
# Initialize Stable Diffusion pipeline based on device
|
24 |
if torch.cuda.is_available():
|
25 |
+
pipe = StableDiffusionPipeline.from_pretrained(HF_API_KEY, torch_dtype=torch.float16)
|
26 |
else:
|
27 |
+
pipe = StableDiffusionPipeline.from_pretrained(HF_API_KEY) # Omit torch_dtype for CPU
|
28 |
|
29 |
# Move model to the selected device (either GPU or CPU)
|
30 |
pipe = pipe.to(device)
|