Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -2,9 +2,9 @@ import spaces
|
|
2 |
import os
|
3 |
import subprocess
|
4 |
import tempfile
|
|
|
5 |
from huggingface_hub import snapshot_download
|
6 |
import gradio as gr
|
7 |
-
import glob
|
8 |
|
9 |
# ---------------- Step 1: Download Model ----------------
|
10 |
repo_id = "Wan-AI/Wan2.2-TI2V-5B"
|
@@ -21,12 +21,12 @@ def get_duration(prompt, size, duration_seconds, steps):
|
|
21 |
h, w = 704, 1280
|
22 |
return int(duration_seconds) * int(steps) * 2.25 + 5
|
23 |
|
24 |
-
# Helper
|
25 |
-
def find_latest_mp4(
|
26 |
-
|
27 |
-
if not
|
28 |
return None
|
29 |
-
latest_file = max(
|
30 |
return latest_file
|
31 |
|
32 |
# ---------------- Step 3: Generation Functions ----------------
|
|
|
2 |
import os
|
3 |
import subprocess
|
4 |
import tempfile
|
5 |
+
import glob
|
6 |
from huggingface_hub import snapshot_download
|
7 |
import gradio as gr
|
|
|
8 |
|
9 |
# ---------------- Step 1: Download Model ----------------
|
10 |
repo_id = "Wan-AI/Wan2.2-TI2V-5B"
|
|
|
21 |
h, w = 704, 1280
|
22 |
return int(duration_seconds) * int(steps) * 2.25 + 5
|
23 |
|
24 |
+
# ---------------- Helper: Find latest .mp4 in cwd ----------------
|
25 |
+
def find_latest_mp4():
|
26 |
+
files = glob.glob("*.mp4")
|
27 |
+
if not files:
|
28 |
return None
|
29 |
+
latest_file = max(files, key=os.path.getctime)
|
30 |
return latest_file
|
31 |
|
32 |
# ---------------- Step 3: Generation Functions ----------------
|