Python25's picture
Update app.py
3b43937 verified
Raw History Blame Contribute Delete
396 Bytes
import gradio as gr
from diffusers import StableDiffusionPipeline
import torch
# Load the model without torch_dtype=torch.float16
pipe = StableDiffusionPipeline.from_pretrained(
"CompVis/stable-diffusion-v1-4"
)
pipe = pipe.to("cpu") # Force CPU
def generate(prompt):
image = pipe(prompt).images[0]
return image
gr.Interface(fn=generate, inputs="text", outputs="image").launch()