Spaces:
Build error
Build error
import gradio as gr | |
from diffusers import StableDiffusionPipeline | |
import torch | |
model_id = "runwayml/stable-diffusion-v1-5" | |
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32) | |
#pipe = pipe.to("cuda") | |
# prompt = "a photo of an astronaut riding a horse on mars" | |
# image.save("astronaut_rides_horse.png") | |
def infer(Prompt): | |
image = pipe(Prompt).images[0] | |
return image | |
iface = gr.Interface(fn=infer, inputs=gr.Textbox(lines=1, placeholder="Prompt Here..."), outputs=gr.Image(label="stable-diffusion-v1-5",visible=True)) | |
iface.launch() |