File size: 565 Bytes
139980d
7338c67
9d65aa7
d5e5583
68dc9bc
35425ea
7338c67
 
 
 
139980d
 
68dc9bc
139980d
68dc9bc
 
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
24
import spaces, torch
from diffusers import DiffusionPipeline
import gradio as gr

pipe = DiffusionPipeline.from_pretrained('ptx0/terminus-xl-velocity-v2', torch_dtype=torch.bfloat16)
#pipe.unet = torch.compile(pipe.unet)
pipe.to('cuda')

@spaces.GPU
def generate(prompt):
    return pipe(
        prompt,
        negative_prompt="underexposed, blurry, ugly, washed-out",
        guidance_rescale=0.7,
        guidance_scale=9.5,
        num_inference_steps=30,
    ).images

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