Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,15 +1,11 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
import torch
|
| 3 |
from diffusers import StableDiffusionPipeline
|
| 4 |
-
|
| 5 |
|
| 6 |
-
# Load model from Hugging Face hub (first time it downloads)
|
| 7 |
pipe = StableDiffusionPipeline.from_pretrained(
|
| 8 |
-
"
|
| 9 |
-
torch_dtype=torch.
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
).to("cpu")
|
| 13 |
|
| 14 |
|
| 15 |
def generate_image(prompt):
|
|
|
|
|
|
|
|
|
|
| 1 |
from diffusers import StableDiffusionPipeline
|
| 2 |
+
import torch
|
| 3 |
|
|
|
|
| 4 |
pipe = StableDiffusionPipeline.from_pretrained(
|
| 5 |
+
"stabilityai/sdxl-turbo",
|
| 6 |
+
torch_dtype=torch.float16, # or float32 if using CPU
|
| 7 |
+
).to("cuda" if torch.cuda.is_available() else "cpu")
|
| 8 |
+
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
def generate_image(prompt):
|