sdtryout / app.py
Icar's picture
Update app.py
a2d1cee
raw
history blame contribute delete
486 Bytes
import gradio as gr
import torch
import diffusers
pipe=diffusers.StableDiffusionPipeline.from_pretrained('stabilityai/stable-diffusion-2-1',torch_dtype=torch.float32)
pipe.to('cuda')
def gen(prompt):
img=pipe(prompt)[0][0]
return img
with gr.Blocks() as demo:
prompt = gr.Textbox(label="Prompt")
output = gr.Image(label="Output Box")
greet_btn = gr.Button("Generate")
greet_btn.click(fn=gen, inputs=prompt, outputs=output, api_name="gen")
demo.launch(debug=True)