Spaces:
Configuration error
Configuration error
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", | |
) | |
def generate(prompt): | |
return pipe(prompt).images | |
gr.Interface( | |
fn=generate, | |
inputs=gr.Text(), | |
outputs=gr.Gallery(), | |
).launch() | |