Spaces:
Sleeping
Sleeping
File size: 396 Bytes
8f54e56 3b43937 8f54e56 3b43937 8f54e56 3b43937 8f54e56 3b43937 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 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()
|