Scorpsuki's picture
Create app.py
d5fe8e7 verified
raw
history blame contribute delete
400 Bytes
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()