Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,11 +5,17 @@ import torch
|
|
| 5 |
import torch.cuda.amp as amp
|
| 6 |
from diffusers import StableDiffusionPipeline
|
| 7 |
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
| 9 |
device = torch.device("cpu") # Default to CPU device
|
| 10 |
if torch.cuda.is_available():
|
| 11 |
device = torch.device("cuda")
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
| 13 |
pipe.to(device)
|
| 14 |
|
| 15 |
def generate(prompt):
|
|
|
|
| 5 |
import torch.cuda.amp as amp
|
| 6 |
from diffusers import StableDiffusionPipeline
|
| 7 |
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
modelid = "stabilityai/stable-diffusion-2-1"
|
| 11 |
+
|
| 12 |
device = torch.device("cpu") # Default to CPU device
|
| 13 |
if torch.cuda.is_available():
|
| 14 |
device = torch.device("cuda")
|
| 15 |
+
|
| 16 |
+
# Use the DPMSolverMultistepScheduler (DPM-Solver++) scheduler here instead
|
| 17 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
| 18 |
+
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
|
| 19 |
pipe.to(device)
|
| 20 |
|
| 21 |
def generate(prompt):
|