Spaces:
Runtime error
Runtime error
import gradio as gr | |
import torch | |
from diffusers import StableDiffusionPipeline | |
model_id = "CompVis/stable-diffusion-v1-4" | |
device = "cuda" | |
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16) | |
pipe = pipe.to(device) | |
def greet(name): | |
prompt = name | |
image = pipe(prompt).images[0] | |
image.save(prompt+".png") | |
return "done" | |
iface = gr.Interface(fn=greet, inputs="text", outputs="text") | |
iface.launch() |