hysts HF Staff commited on
Commit
ec1468b
·
1 Parent(s): 95833ee

Add @spaces.GPU to detect_pose_video

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -173,6 +173,10 @@ def detect_pose_image(
173
  return annotated_frame, human_readable_results
174
 
175
 
 
 
 
 
176
  def detect_pose_video(
177
  video_path: str,
178
  threshold: float,
 
173
  return annotated_frame, human_readable_results
174
 
175
 
176
+ # Decorate this function with `@spaces.GPU` to ensure that ZeroGPU is allocated once for the entire video processing.
177
+ # Although `detect_pose_image` (called per frame) is already decorated, without this decorator, ZeroGPU would be invoked for each frame,
178
+ # causing significant overhead and slowdowns. By decorating this function, all frames are processed sequentially after a single GPU allocation.
179
+ @spaces.GPU(duration=90)
180
  def detect_pose_video(
181
  video_path: str,
182
  threshold: float,