Spaces:
Sleeping
Sleeping
File size: 400 Bytes
d5fe8e7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | import gradio as gr
from diffusers import StableDiffusionPipeline
import torch
model_id = "runwayml/stable-diffusion-v1-5"
pipe = StableDiffusionPipeline.from_pretrained(model_id)
pipe = pipe.to("cuda" if torch.cuda.is_available() else "cpu")
def generate(prompt):
image = pipe(prompt).images[0]
return image
iface = gr.Interface(fn=generate, inputs="text", outputs="image")
iface.launch() |