Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -108,7 +108,7 @@ def preprocess_video_in(video_path):
|
|
108 |
if os.path.splitext(p)[-1] in [".jpg", ".jpeg", ".JPG", ".JPEG"]
|
109 |
]
|
110 |
scanned_frames.sort(key=lambda p: int(os.path.splitext(p)[0]))
|
111 |
-
print(f"SCANNED_FRAMES: {scanned_frames}")
|
112 |
|
113 |
return [
|
114 |
first_frame, # first_frame_path
|
@@ -234,13 +234,13 @@ def get_mask_sam_process(
|
|
234 |
print("PREDICTOR READY")
|
235 |
|
236 |
# `video_dir` a directory of JPEG frames with filenames like `<frame_index>.jpg`
|
237 |
-
print(f"STATE FRAME OUTPUT DIRECTORY: {video_frames_dir}")
|
238 |
video_dir = video_frames_dir
|
239 |
|
240 |
# scan all the JPEG frame names in this directory
|
241 |
frame_names = scanned_frames
|
242 |
|
243 |
-
print(f"STORED INFERENCE STEP: {stored_inference_state}")
|
244 |
if stored_inference_state is None:
|
245 |
# Init SAM2 inference_state
|
246 |
inference_state = predictor.init_state(video_path=video_dir)
|
@@ -398,7 +398,7 @@ def switch_working_frame(working_frame, scanned_frames, video_frames_dir):
|
|
398 |
def reset_propagation(first_frame_path, predictor, stored_inference_state):
|
399 |
|
400 |
predictor.reset_state(stored_inference_state)
|
401 |
-
print(f"RESET State: {stored_inference_state} ")
|
402 |
return first_frame_path, gr.State([]), gr.State([]), gr.update(value=None, visible=False), stored_inference_state, None, ["frame_0.jpg"], first_frame_path, "frame_0.jpg", gr.update(visible=False)
|
403 |
|
404 |
with gr.Blocks() as demo:
|
|
|
108 |
if os.path.splitext(p)[-1] in [".jpg", ".jpeg", ".JPG", ".JPEG"]
|
109 |
]
|
110 |
scanned_frames.sort(key=lambda p: int(os.path.splitext(p)[0]))
|
111 |
+
# print(f"SCANNED_FRAMES: {scanned_frames}")
|
112 |
|
113 |
return [
|
114 |
first_frame, # first_frame_path
|
|
|
234 |
print("PREDICTOR READY")
|
235 |
|
236 |
# `video_dir` a directory of JPEG frames with filenames like `<frame_index>.jpg`
|
237 |
+
# print(f"STATE FRAME OUTPUT DIRECTORY: {video_frames_dir}")
|
238 |
video_dir = video_frames_dir
|
239 |
|
240 |
# scan all the JPEG frame names in this directory
|
241 |
frame_names = scanned_frames
|
242 |
|
243 |
+
# print(f"STORED INFERENCE STEP: {stored_inference_state}")
|
244 |
if stored_inference_state is None:
|
245 |
# Init SAM2 inference_state
|
246 |
inference_state = predictor.init_state(video_path=video_dir)
|
|
|
398 |
def reset_propagation(first_frame_path, predictor, stored_inference_state):
|
399 |
|
400 |
predictor.reset_state(stored_inference_state)
|
401 |
+
# print(f"RESET State: {stored_inference_state} ")
|
402 |
return first_frame_path, gr.State([]), gr.State([]), gr.update(value=None, visible=False), stored_inference_state, None, ["frame_0.jpg"], first_frame_path, "frame_0.jpg", gr.update(visible=False)
|
403 |
|
404 |
with gr.Blocks() as demo:
|