Spaces:
Running
on
Zero
Running
on
Zero
Update app_t2v.py
Browse files- app_t2v.py +7 -0
app_t2v.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
| 3 |
from diffusers import WanPipeline, AutoencoderKLWan
|
|
@@ -19,6 +20,12 @@ pipe = WanPipeline.from_pretrained(
|
|
| 19 |
pipe.to(device)
|
| 20 |
|
| 21 |
# Core inference function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
def generate_video(prompt, negative_prompt, height, width, num_frames, guidance_scale, guidance_scale_2, num_steps):
|
| 23 |
with torch.autocast("cuda", dtype=dtype):
|
| 24 |
output = pipe(
|
|
|
|
| 1 |
+
import spaces
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
from diffusers import WanPipeline, AutoencoderKLWan
|
|
|
|
| 20 |
pipe.to(device)
|
| 21 |
|
| 22 |
# Core inference function
|
| 23 |
+
def get_duration(
|
| 24 |
+
prompt, negative_prompt, height, width, num_frames, guidance_scale, guidance_scale_2, num_steps
|
| 25 |
+
):
|
| 26 |
+
return steps * 15
|
| 27 |
+
|
| 28 |
+
@spaces.GPU(duration=get_duration)
|
| 29 |
def generate_video(prompt, negative_prompt, height, width, num_frames, guidance_scale, guidance_scale_2, num_steps):
|
| 30 |
with torch.autocast("cuda", dtype=dtype):
|
| 31 |
output = pipe(
|