Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -55,8 +55,8 @@ def clear_points(image):
|
|
55 |
# we clean all
|
56 |
return [
|
57 |
image, # first_frame_path
|
58 |
-
|
59 |
-
|
60 |
image, # points_map
|
61 |
#gr.State() # stored_inference_state
|
62 |
]
|
@@ -119,8 +119,8 @@ def preprocess_video_in(video_path):
|
|
119 |
|
120 |
return [
|
121 |
first_frame, # first_frame_path
|
122 |
-
|
123 |
-
|
124 |
first_frame, # input_first_frame_image
|
125 |
first_frame, # points_map
|
126 |
extracted_frames_output_dir, # video_frames_dir
|
@@ -415,7 +415,7 @@ def switch_working_frame(working_frame, scanned_frames, video_frames_dir):
|
|
415 |
frame_number = int(match.group(1))
|
416 |
ann_frame_idx = frame_number
|
417 |
new_working_frame = os.path.join(video_frames_dir, scanned_frames[ann_frame_idx])
|
418 |
-
return
|
419 |
|
420 |
|
421 |
@spaces.GPU(duration=120)
|
@@ -423,19 +423,28 @@ def reset_propagation(first_frame_path, predictor, stored_inference_state):
|
|
423 |
|
424 |
predictor.reset_state(stored_inference_state)
|
425 |
# print(f"RESET State: {stored_inference_state} ")
|
426 |
-
return first_frame_path,
|
427 |
|
428 |
|
429 |
with gr.Blocks(css=css) as demo:
|
430 |
-
first_frame_path = gr.State()
|
431 |
-
tracking_points = gr.State([])
|
432 |
-
trackings_input_label = gr.State([])
|
433 |
-
video_frames_dir = gr.State()
|
434 |
-
scanned_frames = gr.State()
|
435 |
-
loaded_predictor = gr.State()
|
436 |
-
stored_inference_state = gr.State()
|
437 |
-
stored_frame_names = gr.State()
|
438 |
-
available_frames_to_check = gr.State([])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
439 |
with gr.Column():
|
440 |
gr.Markdown(
|
441 |
"""
|
|
|
55 |
# we clean all
|
56 |
return [
|
57 |
image, # first_frame_path
|
58 |
+
[], # tracking_points
|
59 |
+
[], # trackings_input_label
|
60 |
image, # points_map
|
61 |
#gr.State() # stored_inference_state
|
62 |
]
|
|
|
119 |
|
120 |
return [
|
121 |
first_frame, # first_frame_path
|
122 |
+
[], # tracking_points
|
123 |
+
[], # trackings_input_label
|
124 |
first_frame, # input_first_frame_image
|
125 |
first_frame, # points_map
|
126 |
extracted_frames_output_dir, # video_frames_dir
|
|
|
415 |
frame_number = int(match.group(1))
|
416 |
ann_frame_idx = frame_number
|
417 |
new_working_frame = os.path.join(video_frames_dir, scanned_frames[ann_frame_idx])
|
418 |
+
return [], [], new_working_frame, new_working_frame
|
419 |
|
420 |
|
421 |
@spaces.GPU(duration=120)
|
|
|
423 |
|
424 |
predictor.reset_state(stored_inference_state)
|
425 |
# print(f"RESET State: {stored_inference_state} ")
|
426 |
+
return first_frame_path, [], [], gr.update(value=None, visible=False), stored_inference_state, None, ["frame_0.jpg"], first_frame_path, "frame_0.jpg", gr.update(visible=False)
|
427 |
|
428 |
|
429 |
with gr.Blocks(css=css) as demo:
|
430 |
+
# first_frame_path = gr.State()
|
431 |
+
# tracking_points = gr.State([])
|
432 |
+
# trackings_input_label = gr.State([])
|
433 |
+
# video_frames_dir = gr.State()
|
434 |
+
# scanned_frames = gr.State()
|
435 |
+
# loaded_predictor = gr.State()
|
436 |
+
# stored_inference_state = gr.State()
|
437 |
+
# stored_frame_names = gr.State()
|
438 |
+
# available_frames_to_check = gr.State([])
|
439 |
+
first_frame_path = None
|
440 |
+
tracking_points = []
|
441 |
+
trackings_input_label = []
|
442 |
+
video_frames_dir = None
|
443 |
+
scanned_frames = None
|
444 |
+
loaded_predictor = None
|
445 |
+
stored_inference_state = None
|
446 |
+
stored_frame_names = None
|
447 |
+
available_frames_to_check = []
|
448 |
with gr.Column():
|
449 |
gr.Markdown(
|
450 |
"""
|