Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -223,7 +223,7 @@ def inference_and_return_video(dilation_iterations, num_inference_steps, video_s
|
|
223 |
clip.write_videofile(video_file, codec='libx264', audio=False, verbose=False, logger=None)
|
224 |
return video_file
|
225 |
|
226 |
-
@spaces.GPU(duration=
|
227 |
def track_video(n_frames, video_state):
|
228 |
|
229 |
input_points = video_state["input_points"]
|
@@ -248,7 +248,9 @@ def track_video(n_frames, video_state):
|
|
248 |
video_state["origin_images"] = images
|
249 |
images = np.array(images)
|
250 |
|
251 |
-
|
|
|
|
|
252 |
|
253 |
inference_state = video_predictor.init_state(images=images/255, device="cuda")
|
254 |
video_state["inference_state"] = inference_state
|
|
|
223 |
clip.write_videofile(video_file, codec='libx264', audio=False, verbose=False, logger=None)
|
224 |
return video_file
|
225 |
|
226 |
+
@spaces.GPU(duration=150)
|
227 |
def track_video(n_frames, video_state):
|
228 |
|
229 |
input_points = video_state["input_points"]
|
|
|
248 |
video_state["origin_images"] = images
|
249 |
images = np.array(images)
|
250 |
|
251 |
+
sam2_checkpoint = "./SAM2-Video-Predictor/checkpoints/sam2_hiera_large.pt"
|
252 |
+
config = "sam2_hiera_l.yaml"
|
253 |
+
video_predictor = build_sam2_video_predictor(config, sam2_checkpoint, device="cuda")
|
254 |
|
255 |
inference_state = video_predictor.init_state(images=images/255, device="cuda")
|
256 |
video_state["inference_state"] = inference_state
|