Spaces:
Runtime error
Runtime error
File size: 493 Bytes
2b62e8c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import torch
import gradio as gr
from diffusers import StableDiffusionPipeline
# Load the pretrained text-to-image pipeline
pipe = StableDiffusionPipeline.from_pretrained(
"stabilityai/stable-diffusion-2-1",
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
).to("cuda" if torch.cuda.is_available() else "cpu")
# Automatically generate a UI from the pipeline
demo = gr.Interface.from_pipeline(pipe, title="Text-to-Image with Stable Diffusion")
demo.launch() |