Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,15 +2,15 @@ import gradio as gr
|
|
| 2 |
from diffusers import StableDiffusionPipeline
|
| 3 |
import torch
|
| 4 |
|
|
|
|
| 5 |
pipe = StableDiffusionPipeline.from_pretrained(
|
| 6 |
-
"CompVis/stable-diffusion-v1-4"
|
| 7 |
-
torch_dtype=torch.float16,
|
| 8 |
-
revision="fp16"
|
| 9 |
)
|
| 10 |
-
pipe = pipe.to("
|
| 11 |
|
| 12 |
def generate(prompt):
|
| 13 |
image = pipe(prompt).images[0]
|
| 14 |
return image
|
| 15 |
|
| 16 |
gr.Interface(fn=generate, inputs="text", outputs="image").launch()
|
|
|
|
|
|
| 2 |
from diffusers import StableDiffusionPipeline
|
| 3 |
import torch
|
| 4 |
|
| 5 |
+
# Load the model without torch_dtype=torch.float16
|
| 6 |
pipe = StableDiffusionPipeline.from_pretrained(
|
| 7 |
+
"CompVis/stable-diffusion-v1-4"
|
|
|
|
|
|
|
| 8 |
)
|
| 9 |
+
pipe = pipe.to("cpu") # Force CPU
|
| 10 |
|
| 11 |
def generate(prompt):
|
| 12 |
image = pipe(prompt).images[0]
|
| 13 |
return image
|
| 14 |
|
| 15 |
gr.Interface(fn=generate, inputs="text", outputs="image").launch()
|
| 16 |
+
|