Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,15 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from
|
|
|
|
| 3 |
|
| 4 |
-
# Load
|
| 5 |
-
|
|
|
|
|
|
|
| 6 |
|
| 7 |
def generate_image(description):
|
| 8 |
# Generate an image based on the description
|
| 9 |
-
image =
|
| 10 |
return image
|
| 11 |
|
| 12 |
# Set up the Gradio interface
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from diffusers import StableDiffusionPipeline
|
| 3 |
+
import torch
|
| 4 |
|
| 5 |
+
# Load Stable Diffusion pipeline (make sure to use the right model name)
|
| 6 |
+
model_name = "CompVis/stable-diffusion-v-1-4-original"
|
| 7 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_name, torch_dtype=torch.float16)
|
| 8 |
+
pipe.to("cuda") # Move the model to GPU (if available)
|
| 9 |
|
| 10 |
def generate_image(description):
|
| 11 |
# Generate an image based on the description
|
| 12 |
+
image = pipe(description).images[0]
|
| 13 |
return image
|
| 14 |
|
| 15 |
# Set up the Gradio interface
|