fcakyon commited on
Commit
8080af0
·
verified ·
1 Parent(s): d327c66

dont clear selected points until `Clear points` button is pressed

Browse files

Works great on my fork.

cc:

@An-619

Files changed (1) hide show
  1. app_gradio.py +4 -4
app_gradio.py CHANGED
@@ -159,9 +159,7 @@ def segment_with_points(
159
  use_retina=use_retina,
160
  withContours=withContours,)
161
 
162
- global_points = []
163
- global_point_label = []
164
- return fig, None
165
 
166
 
167
  def get_points_with_draw(image, label, evt: gr.SelectData):
@@ -297,7 +295,7 @@ with gr.Blocks(css=css, title='Fast Segment Anything') as demo:
297
 
298
  segment_btn_p.click(segment_with_points,
299
  inputs=[cond_img_p],
300
- outputs=[segm_img_p, cond_img_p])
301
 
302
  with gr.Tab("Text mode"):
303
  # Images
@@ -361,6 +359,8 @@ with gr.Blocks(css=css, title='Fast Segment Anything') as demo:
361
  outputs=segm_img_t)
362
 
363
  def clear():
 
 
364
  return None, None
365
 
366
  def clear_text():
 
159
  use_retina=use_retina,
160
  withContours=withContours,)
161
 
162
+ return fig
 
 
163
 
164
 
165
  def get_points_with_draw(image, label, evt: gr.SelectData):
 
295
 
296
  segment_btn_p.click(segment_with_points,
297
  inputs=[cond_img_p],
298
+ outputs=[segm_img_p])
299
 
300
  with gr.Tab("Text mode"):
301
  # Images
 
359
  outputs=segm_img_t)
360
 
361
  def clear():
362
+ global_points = []
363
+ global_point_label = []
364
  return None, None
365
 
366
  def clear_text():