BoxOfColors commited on
Commit
25f6ae6
·
1 Parent(s): a99f759

Fix torchaudio missing dep and TARO sys.path for bare imports

Browse files
Files changed (2) hide show
  1. app.py +7 -0
  2. requirements.txt +2 -1
app.py CHANGED
@@ -239,6 +239,13 @@ def generate_taro(video_file, seed_val, cfg_scale, num_steps, mode,
239
  device = "cuda" if torch.cuda.is_available() else "cpu"
240
  weight_dtype = torch.bfloat16
241
 
 
 
 
 
 
 
 
242
  # Imports are inside the GPU context so the Space only pays for GPU time here
243
  from TARO.cavp_util import Extract_CAVP_Features
244
  from TARO.onset_util import VideoOnsetNet, extract_onset
 
239
  device = "cuda" if torch.cuda.is_available() else "cpu"
240
  weight_dtype = torch.bfloat16
241
 
242
+ # TARO modules use bare imports (e.g. `from cavp_util import ...`) that
243
+ # assume the TARO directory is on sys.path. Add it before importing.
244
+ import sys, os as _os
245
+ _taro_dir = _os.path.join(_os.path.dirname(_os.path.abspath(__file__)), "TARO")
246
+ if _taro_dir not in sys.path:
247
+ sys.path.insert(0, _taro_dir)
248
+
249
  # Imports are inside the GPU context so the Space only pays for GPU time here
250
  from TARO.cavp_util import Extract_CAVP_Features
251
  from TARO.onset_util import VideoOnsetNet, extract_onset
requirements.txt CHANGED
@@ -15,4 +15,5 @@ omegaconf
15
  spaces==0.48.1
16
  gradio==5.25.0
17
  pydantic==2.8.2
18
- av
 
 
15
  spaces==0.48.1
16
  gradio==5.25.0
17
  pydantic==2.8.2
18
+ av
19
+ torchaudio