File size: 580 Bytes
5d4ed8e
0e2b43c
 
5d4ed8e
006acab
bb9a6c3
bc392de
d584767
fc09f75
0e2b43c
006acab
fc09f75
 
0e2b43c
 
d584767
44d5f8c
0e2b43c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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()