text2img / app.py
Arafath10's picture
Update app.py
4127a8c
raw
history blame
450 Bytes
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()