yyfz233 commited on
Commit
00143c1
·
1 Parent(s): da56ac4

Support Huggingface GPU

Browse files
Files changed (2) hide show
  1. app.py +3 -0
  2. requirements.txt +2 -1
app.py CHANGED
@@ -15,6 +15,7 @@ from datetime import datetime
15
  import glob
16
  import gc
17
  import time
 
18
 
19
  from pi3.utils.geometry import se3_inverse, homogenize_points, depth_edge
20
  from pi3.models.pi3 import Pi3
@@ -274,6 +275,7 @@ def compute_camera_faces(cone_shape: trimesh.Trimesh) -> np.ndarray:
274
  # -------------------------------------------------------------------------
275
  # 1) Core model inference
276
  # -------------------------------------------------------------------------
 
277
  def run_model(target_dir, model) -> dict:
278
  print(f"Processing images from {target_dir}")
279
 
@@ -415,6 +417,7 @@ def update_gallery_on_upload(input_video, input_images, interval=-1):
415
  # -------------------------------------------------------------------------
416
  # 4) Reconstruction: uses the target_dir plus any viz parameters
417
  # -------------------------------------------------------------------------
 
418
  def gradio_demo(
419
  target_dir,
420
  conf_thres=3.0,
 
15
  import glob
16
  import gc
17
  import time
18
+ import spaces
19
 
20
  from pi3.utils.geometry import se3_inverse, homogenize_points, depth_edge
21
  from pi3.models.pi3 import Pi3
 
275
  # -------------------------------------------------------------------------
276
  # 1) Core model inference
277
  # -------------------------------------------------------------------------
278
+ @spaces.GPU(duration=120)
279
  def run_model(target_dir, model) -> dict:
280
  print(f"Processing images from {target_dir}")
281
 
 
417
  # -------------------------------------------------------------------------
418
  # 4) Reconstruction: uses the target_dir plus any viz parameters
419
  # -------------------------------------------------------------------------
420
+ @spaces.GPU(duration=120)
421
  def gradio_demo(
422
  target_dir,
423
  conf_thres=3.0,
requirements.txt CHANGED
@@ -11,4 +11,5 @@ safetensors
11
  gradio
12
  trimesh
13
  matplotlib
14
- scipy
 
 
11
  gradio
12
  trimesh
13
  matplotlib
14
+ scipy
15
+ spaces