Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,25 +2,37 @@ import gradio as gr
|
|
| 2 |
import os
|
| 3 |
import tempfile
|
| 4 |
from huggingface_hub import snapshot_download
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
| 6 |
import spaces
|
| 7 |
|
| 8 |
-
import
|
| 9 |
-
import os
|
| 10 |
-
import sys
|
| 11 |
|
| 12 |
-
#
|
| 13 |
PUSA_PATH = os.path.abspath("./PusaV1")
|
| 14 |
if PUSA_PATH not in sys.path:
|
| 15 |
sys.path.insert(0, PUSA_PATH)
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
setup_file = os.path.join(PUSA_PATH, "setup.py")
|
| 21 |
if os.path.exists(setup_file):
|
| 22 |
subprocess.run([sys.executable, setup_file, "install"], check=False)
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
# Constants
|
| 26 |
WAN_SUBFOLDER = "Wan2.1-T2V-14B"
|
|
|
|
| 2 |
import os
|
| 3 |
import tempfile
|
| 4 |
from huggingface_hub import snapshot_download
|
| 5 |
+
import sys, os
|
| 6 |
+
sys.path.insert(0, os.path.abspath("./PusaV1"))
|
| 7 |
+
|
| 8 |
+
|
| 9 |
import spaces
|
| 10 |
|
| 11 |
+
import sys, os
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
# Add PusaV1 to sys.path if not already
|
| 14 |
PUSA_PATH = os.path.abspath("./PusaV1")
|
| 15 |
if PUSA_PATH not in sys.path:
|
| 16 |
sys.path.insert(0, PUSA_PATH)
|
| 17 |
|
| 18 |
+
# Validate diffsynth presence
|
| 19 |
+
DIFFSYNTH_PATH = os.path.join(PUSA_PATH, "diffsynth")
|
| 20 |
+
if not os.path.exists(DIFFSYNTH_PATH):
|
| 21 |
+
raise RuntimeError(
|
| 22 |
+
f"'diffsynth' package not found in {PUSA_PATH}. "
|
| 23 |
+
f"Ensure PusaV1 is correctly cloned and folder structure is intact."
|
| 24 |
+
)
|
| 25 |
|
|
|
|
| 26 |
if os.path.exists(setup_file):
|
| 27 |
subprocess.run([sys.executable, setup_file, "install"], check=False)
|
| 28 |
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
from PusaV1.diffsynth import ModelManager, WanVideoPusaPipeline, save_video
|
| 36 |
|
| 37 |
# Constants
|
| 38 |
WAN_SUBFOLDER = "Wan2.1-T2V-14B"
|