Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -384,7 +384,7 @@ def switch_working_frame(working_frame, scanned_frames, video_frames_dir):
|
|
384 |
new_working_frame = None
|
385 |
if working_frame == None:
|
386 |
new_working_frame = os.path.join(video_frames_dir, scanned_frames[0])
|
387 |
-
|
388 |
else:
|
389 |
# Use a regular expression to find the integer
|
390 |
match = re.search(r'frame_(\d+)', working_frame)
|
@@ -393,7 +393,7 @@ def switch_working_frame(working_frame, scanned_frames, video_frames_dir):
|
|
393 |
frame_number = int(match.group(1))
|
394 |
ann_frame_idx = frame_number
|
395 |
new_working_frame = os.path.join(video_frames_dir, scanned_frames[ann_frame_idx])
|
396 |
-
|
397 |
|
398 |
def reset_propagation(predictor, stored_inference_state):
|
399 |
|
@@ -446,8 +446,9 @@ with gr.Blocks() as demo:
|
|
446 |
video_in = gr.Video(label="Video IN")
|
447 |
|
448 |
with gr.Column():
|
449 |
-
|
450 |
-
|
|
|
451 |
output_result = gr.Image(label="current working mask ref")
|
452 |
with gr.Row():
|
453 |
vis_frame_type = gr.Radio(label="Propagation level", choices=["check", "render"], value="check", scale=2)
|
@@ -511,10 +512,10 @@ with gr.Blocks() as demo:
|
|
511 |
)
|
512 |
|
513 |
|
514 |
-
|
515 |
fn = switch_working_frame,
|
516 |
inputs = [working_frame, scanned_frames, video_frames_dir],
|
517 |
-
outputs = [
|
518 |
queue=False
|
519 |
)
|
520 |
|
|
|
384 |
new_working_frame = None
|
385 |
if working_frame == None:
|
386 |
new_working_frame = os.path.join(video_frames_dir, scanned_frames[0])
|
387 |
+
|
388 |
else:
|
389 |
# Use a regular expression to find the integer
|
390 |
match = re.search(r'frame_(\d+)', working_frame)
|
|
|
393 |
frame_number = int(match.group(1))
|
394 |
ann_frame_idx = frame_number
|
395 |
new_working_frame = os.path.join(video_frames_dir, scanned_frames[ann_frame_idx])
|
396 |
+
return gr.State([]), gr.State([]), new_working_frame, new_working_frame
|
397 |
|
398 |
def reset_propagation(predictor, stored_inference_state):
|
399 |
|
|
|
446 |
video_in = gr.Video(label="Video IN")
|
447 |
|
448 |
with gr.Column():
|
449 |
+
with gf.Row():
|
450 |
+
working_frame = gr.Dropdown(label="working frame ID", choices=[""], value=None, visible=False, allow_custom_value=False, interactive=True)
|
451 |
+
change_current = gr.Button("change current ")
|
452 |
output_result = gr.Image(label="current working mask ref")
|
453 |
with gr.Row():
|
454 |
vis_frame_type = gr.Radio(label="Propagation level", choices=["check", "render"], value="check", scale=2)
|
|
|
512 |
)
|
513 |
|
514 |
|
515 |
+
change_current.click(
|
516 |
fn = switch_working_frame,
|
517 |
inputs = [working_frame, scanned_frames, video_frames_dir],
|
518 |
+
outputs = [tracking_points, trackings_input_label, input_first_frame_image, points_map],
|
519 |
queue=False
|
520 |
)
|
521 |
|