Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -28,6 +28,8 @@ JS = """function () {
|
|
28 |
}
|
29 |
}"""
|
30 |
|
|
|
|
|
31 |
# Load VAE component
|
32 |
vae = AutoencoderKL.from_pretrained(
|
33 |
vae_model,
|
@@ -36,7 +38,7 @@ vae = AutoencoderKL.from_pretrained(
|
|
36 |
|
37 |
# Ensure model and scheduler are initialized in GPU-enabled function
|
38 |
if torch.cuda.is_available():
|
39 |
-
pipe = StableDiffusionXLPipeline.from_pretrained(model, vae=vae, torch_dtype=torch.float16).to(
|
40 |
|
41 |
|
42 |
|
|
|
28 |
}
|
29 |
}"""
|
30 |
|
31 |
+
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
32 |
+
|
33 |
# Load VAE component
|
34 |
vae = AutoencoderKL.from_pretrained(
|
35 |
vae_model,
|
|
|
38 |
|
39 |
# Ensure model and scheduler are initialized in GPU-enabled function
|
40 |
if torch.cuda.is_available():
|
41 |
+
pipe = StableDiffusionXLPipeline.from_pretrained(model, vae=vae, torch_dtype=torch.float16).to(device)
|
42 |
|
43 |
|
44 |
|