Zero_demo / app.py
hpoghos's picture
Update app.py
16def27 verified
raw
history blame
526 Bytes
import torch
import spaces
import gradio as gr
from diffusers import StableDiffusionPipeline
from open_clip import create_model_and_transforms
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4").to('cuda')
model, _, _ = create_model_and_transforms(
"ViT-H-14",
device=torch.device("cpu"),
pretrained="laion2b_s32b_b79k",
)
@spaces.GPU
def generate(prompt):
return pipe(prompt).images
gr.Interface(
fn=generate,
inputs=gr.Text(),
outputs=gr.Gallery(),
).launch()