rahul7star commited on
Commit
02f7f0d
·
verified ·
1 Parent(s): 1a4ff0e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -8
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
- from diffsynth import ModelManager, WanVideoPusaPipeline, save_video
 
 
 
6
  import spaces
7
 
8
- import subprocess
9
- import os
10
- import sys
11
 
12
- # Install PusaV1 locally if not already installed
13
  PUSA_PATH = os.path.abspath("./PusaV1")
14
  if PUSA_PATH not in sys.path:
15
  sys.path.insert(0, PUSA_PATH)
16
 
17
- if not os.path.exists(os.path.join(PUSA_PATH, "diffsynth")):
18
- raise RuntimeError("PusaV1 folder is missing or incorrectly placed.")
 
 
 
 
 
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"