Spaces:
Running
on
Zero
Running
on
Zero
File size: 617 Bytes
c4cc804 2b949d1 3075cc3 2b949d1 c4cc804 2b949d1 b3e1ee8 2b949d1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
from diffusers import StableDiffusionXLPipeline
import torch
from gradio import Interface, Image
import gradio as gr
import spaces
model_id = "RunDiffusion/Juggernaut-X-v10"
pipe = StableDiffusionXLPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe = pipe.to("cuda")
@spaces.GPU()
def text_to_image(prompt, progress=gr.Progress(track_tqdm=True)):
image = pipe(prompt).images [0]
return image
gradio_interface = Interface(
fn=text_to_image,
inputs="text",
outputs=Image(type="pil", show_download_button=True),
examples=[["person running"]],
theme=gr.themes.Soft()
)
gradio_interface.launch() |