Spaces:
Sleeping
Sleeping
PseudoTerminal X
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,14 @@
|
|
| 1 |
import torch
|
| 2 |
from diffusers import DiffusionPipeline
|
| 3 |
import gradio as gr
|
|
|
|
| 4 |
|
| 5 |
# Load the pre-trained diffusion model
|
| 6 |
pipe = DiffusionPipeline.from_pretrained('ptx0/terminus-xl-velocity-v2', torch_dtype=torch.bfloat16)
|
| 7 |
pipe.to('cuda')
|
| 8 |
|
| 9 |
# Define the image generation function with adjustable parameters and a progress bar
|
|
|
|
| 10 |
def generate(prompt, guidance_scale, num_inference_steps, negative_prompt):
|
| 11 |
with gr.Progress(steps=num_inference_steps) as progress:
|
| 12 |
for i in range(num_inference_steps):
|
|
|
|
| 1 |
import torch
|
| 2 |
from diffusers import DiffusionPipeline
|
| 3 |
import gradio as gr
|
| 4 |
+
import spaces
|
| 5 |
|
| 6 |
# Load the pre-trained diffusion model
|
| 7 |
pipe = DiffusionPipeline.from_pretrained('ptx0/terminus-xl-velocity-v2', torch_dtype=torch.bfloat16)
|
| 8 |
pipe.to('cuda')
|
| 9 |
|
| 10 |
# Define the image generation function with adjustable parameters and a progress bar
|
| 11 |
+
@spaces.GPU
|
| 12 |
def generate(prompt, guidance_scale, num_inference_steps, negative_prompt):
|
| 13 |
with gr.Progress(steps=num_inference_steps) as progress:
|
| 14 |
for i in range(num_inference_steps):
|