Podfusion / app.py
fdsodfs
Add requirements.txt
fbe7c5b
raw
history blame
545 Bytes
import gradio as gr
import torch
from torch import autocast
from diffusers import StableDiffusionPipeline
def get_stable_diffusion_random_image(prompt):
model_id = "CompVis/stable-diffusion-v1-4"
device = "cuda"
pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=True)
pipe = pipe.to(device)
with autocast("cuda"):
image = pipe(prompt, guidance_scale=7.5)
return image
iface = gr.Interface(fn=get_stable_diffusion_random_image, inputs="text", outputs="image")
iface.launch(share=True)