Spaces:
Sleeping
Sleeping
PseudoTerminal X
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,19 @@
|
|
| 1 |
-
import spaces
|
| 2 |
from diffusers import DiffusionPipeline
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
-
pipe = DiffusionPipeline.from_pretrained('ptx0/terminus-xl-velocity-v2')
|
|
|
|
| 6 |
pipe.to('cuda')
|
| 7 |
|
| 8 |
@spaces.GPU
|
| 9 |
def generate(prompt):
|
| 10 |
-
return pipe(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
gr.Interface(
|
| 13 |
fn=generate,
|
|
|
|
| 1 |
+
import spaces, torch
|
| 2 |
from diffusers import DiffusionPipeline
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
+
pipe = DiffusionPipeline.from_pretrained('ptx0/terminus-xl-velocity-v2', torch_dtype=torch.float16)
|
| 6 |
+
pipe.unet = torch.compile(pipe.unet, mode='max-autotune', fullgraph=True)
|
| 7 |
pipe.to('cuda')
|
| 8 |
|
| 9 |
@spaces.GPU
|
| 10 |
def generate(prompt):
|
| 11 |
+
return pipe(
|
| 12 |
+
prompt,
|
| 13 |
+
guidance_rescale=0.7,
|
| 14 |
+
guidance_scale=7.5,
|
| 15 |
+
num_inference_steps=25,
|
| 16 |
+
).images
|
| 17 |
|
| 18 |
gr.Interface(
|
| 19 |
fn=generate,
|