murphylmf commited on
Commit
17bbbf7
·
1 Parent(s): a7492f1
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -74,8 +74,7 @@ def install_pytorch3d():
74
  subprocess.run([sys.executable, "-m", "pip", "install", whl_url], check=True)
75
  print("✅ PyTorch3D installed via Wheel!")
76
  except subprocess.CalledProcessError:
77
- print("⚠️ Wheel installation failed (maybe version mismatch).")
78
- print("🔨 Falling back to source compilation (this will take a few minutes)...")
79
  subprocess.run(
80
  [sys.executable, "-m", "pip", "install", "--no-build-isolation", "git+https://github.com/facebookresearch/pytorch3d.git@stable"],
81
  check=True
@@ -451,7 +450,14 @@ def predict(video_path, start_time=0.0, end_time=10.0):
451
 
452
  examples_list = []
453
  if os.path.exists(EXAMPLES_DIR):
454
- examples_list = [[os.path.join("examples", f)] for f in os.listdir(EXAMPLES_DIR) if f.endswith(".mp4")]
 
 
 
 
 
 
 
455
 
456
  js_scrub = """(val) => {
457
  var video = document.querySelector('#input-video video');
 
74
  subprocess.run([sys.executable, "-m", "pip", "install", whl_url], check=True)
75
  print("✅ PyTorch3D installed via Wheel!")
76
  except subprocess.CalledProcessError:
77
+ print("⚠️ Wheel installation failed. Falling back to source compilation...")
 
78
  subprocess.run(
79
  [sys.executable, "-m", "pip", "install", "--no-build-isolation", "git+https://github.com/facebookresearch/pytorch3d.git@stable"],
80
  check=True
 
450
 
451
  examples_list = []
452
  if os.path.exists(EXAMPLES_DIR):
453
+ # Dynamic duration calculation for examples
454
+ for f in os.listdir(EXAMPLES_DIR):
455
+ if f.endswith(".mp4"):
456
+ video_path = os.path.join("examples", f)
457
+ abs_path = os.path.join(EXAMPLES_DIR, f)
458
+ dur = get_video_duration(abs_path)
459
+ # Default example: 0.0s to min(duration, 10.0s)
460
+ examples_list.append([video_path, 0.0, min(dur, 10.0)])
461
 
462
  js_scrub = """(val) => {
463
  var video = document.querySelector('#input-video video');