File size: 537 Bytes
139980d
7338c67
9d65aa7
d5e5583
139980d
00d385d
7338c67
 
 
 
139980d
 
 
 
 
 
7338c67
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import spaces, torch
from diffusers import DiffusionPipeline
import gradio as gr

pipe = DiffusionPipeline.from_pretrained('ptx0/terminus-xl-velocity-v2', torch_dtype=torch.float16)
pipe.unet = torch.compile(pipe.unet, mode='reduce-overhead', fullgraph=True)
pipe.to('cuda')

@spaces.GPU
def generate(prompt):
    return pipe(
        prompt,
        guidance_rescale=0.7,
        guidance_scale=7.5,
        num_inference_steps=25,
    ).images

gr.Interface(
    fn=generate,
    inputs=gr.Text(),
    outputs=gr.Gallery(),
).launch()