fffiloni commited on
Commit
51c3be9
1 Parent(s): 5dc63c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -145,11 +145,18 @@ with gr.Blocks() as demo:
145
  with gr.Row():
146
  input_image = gr.Image(label="input image", interactive=True, type="filepath")
147
  with gr.Column():
148
- point_type = gr.Radio(label="point type", choices=["include", "exclude"], value="include")
 
 
149
  points_map = gr.Image(label="points map", interactive=False)
150
  submit_btn = gr.Button("Submit")
151
  output_result = gr.Image()
152
 
 
 
 
 
 
153
  input_image.upload(preprocess_image, input_image, [first_frame_path, tracking_points, trackings_input_label, points_map])
154
 
155
  points_map.select(get_point, [point_type, tracking_points, trackings_input_label, first_frame_path], [tracking_points, trackings_input_label, points_map])
 
145
  with gr.Row():
146
  input_image = gr.Image(label="input image", interactive=True, type="filepath")
147
  with gr.Column():
148
+ with gr.Row():
149
+ point_type = gr.Radio(label="point type", choices=["include", "exclude"], value="include")
150
+ clear_points_btn = gr.Button("Clear Points")
151
  points_map = gr.Image(label="points map", interactive=False)
152
  submit_btn = gr.Button("Submit")
153
  output_result = gr.Image()
154
 
155
+ clear_points_btn.click(
156
+ fn = preprocess_image,
157
+ inputs = input_image,
158
+ outputs = [first_frame_path, tracking_points, trackings_input_label, points_map]
159
+ )
160
  input_image.upload(preprocess_image, input_image, [first_frame_path, tracking_points, trackings_input_label, points_map])
161
 
162
  points_map.select(get_point, [point_type, tracking_points, trackings_input_label, first_frame_path], [tracking_points, trackings_input_label, points_map])