Spaces:
Runtime error
Runtime error
Update app_gradio.py
Browse files- app_gradio.py +6 -1
app_gradio.py
CHANGED
|
@@ -359,13 +359,18 @@ with gr.Blocks(css=css, title='Fast Segment Anything') as demo:
|
|
| 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():
|
| 367 |
return None, None, None
|
| 368 |
|
|
|
|
|
|
|
|
|
|
| 369 |
cond_img_p.clear(clear, outputs=[cond_img_e, segm_img_e]) # reset when input image is cleared
|
| 370 |
cond_img_p.input(clear, outputs=[cond_img_e, segm_img_e]) # reset when input image is changed
|
| 371 |
clear_btn_e.click(clear, outputs=[cond_img_e, segm_img_e])
|
|
|
|
| 359 |
outputs=segm_img_t)
|
| 360 |
|
| 361 |
def clear():
|
| 362 |
+
global global_points
|
| 363 |
+
global global_point_label
|
| 364 |
global_points = []
|
| 365 |
global_point_label = []
|
| 366 |
return None, None
|
| 367 |
+
|
| 368 |
def clear_text():
|
| 369 |
return None, None, None
|
| 370 |
|
| 371 |
+
everything_tab.select(clear, outputs=[cond_img_e, segm_img_e]) # reset when everything tab is selected
|
| 372 |
+
points_tab.select(clear, outputs=[cond_img_e, segm_img_e]) # reset when points tab is selected
|
| 373 |
+
text_tab.select(clear, outputs=[cond_img_e, segm_img_e]) # reset when text tab is selected
|
| 374 |
cond_img_p.clear(clear, outputs=[cond_img_e, segm_img_e]) # reset when input image is cleared
|
| 375 |
cond_img_p.input(clear, outputs=[cond_img_e, segm_img_e]) # reset when input image is changed
|
| 376 |
clear_btn_e.click(clear, outputs=[cond_img_e, segm_img_e])
|