Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,12 +2,13 @@ import torch
|
|
2 |
from diffusers import StableDiffusionPipeline
|
3 |
import gradio as gr
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
pipe.
|
|
|
8 |
|
9 |
def generate_image(prompt, pipe):
|
10 |
-
# Generate the image using the pipeline
|
11 |
image = pipe(prompt, guidance_scale=7.5, num_inference_steps=50).images[0]
|
12 |
return image
|
13 |
|
@@ -21,7 +22,7 @@ interface = gr.Interface(
|
|
21 |
fn=chatbot,
|
22 |
inputs="text",
|
23 |
outputs="image",
|
24 |
-
title="
|
25 |
description="Enter a text prompt and get an AI-generated image."
|
26 |
)
|
27 |
|
|
|
2 |
from diffusers import StableDiffusionPipeline
|
3 |
import gradio as gr
|
4 |
|
5 |
+
# Use the CompVis stable-diffusion-v1-4 model
|
6 |
+
model_id = "CompVis/stable-diffusion-v1-4"
|
7 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32) # float32 for CPU
|
8 |
+
pipe.to("cpu") # Ensure it runs on CPU
|
9 |
|
10 |
def generate_image(prompt, pipe):
|
11 |
+
# Generate the image using the pipeline
|
12 |
image = pipe(prompt, guidance_scale=7.5, num_inference_steps=50).images[0]
|
13 |
return image
|
14 |
|
|
|
22 |
fn=chatbot,
|
23 |
inputs="text",
|
24 |
outputs="image",
|
25 |
+
title="Stable Diffusion v1-4 Text-to-Image Chatbot",
|
26 |
description="Enter a text prompt and get an AI-generated image."
|
27 |
)
|
28 |
|