Spaces:
Running
Running
AAAAAAAyq
commited on
Commit
•
5778432
1
Parent(s):
4b45202
Better points mode & Fix the Contours button bug
Browse files- app_gradio.py +19 -19
app_gradio.py
CHANGED
@@ -189,7 +189,7 @@ segm_img_t = gr.Image(label="Segmented Image with text", interactive=False, type
|
|
189 |
global_points = []
|
190 |
global_point_label = []
|
191 |
|
192 |
-
|
193 |
maximum=1024,
|
194 |
value=1024,
|
195 |
step=64,
|
@@ -218,7 +218,7 @@ with gr.Blocks(css=css, title='Fast Segment Anything') as demo:
|
|
218 |
# Submit & Clear
|
219 |
with gr.Row():
|
220 |
with gr.Column():
|
221 |
-
|
222 |
|
223 |
with gr.Row():
|
224 |
contour_check_e = gr.Checkbox(value=True, label='withContours', info='draw the edges of the masks')
|
@@ -238,12 +238,12 @@ with gr.Blocks(css=css, title='Fast Segment Anything') as demo:
|
|
238 |
with gr.Column():
|
239 |
with gr.Accordion("Advanced options", open=False):
|
240 |
# text_box = gr.Textbox(label="text prompt")
|
241 |
-
|
242 |
-
|
243 |
with gr.Row():
|
244 |
-
|
245 |
with gr.Column():
|
246 |
-
|
247 |
# Description
|
248 |
gr.Markdown(description_e)
|
249 |
|
@@ -315,12 +315,12 @@ with gr.Blocks(css=css, title='Fast Segment Anything') as demo:
|
|
315 |
|
316 |
with gr.Column():
|
317 |
with gr.Accordion("Advanced options", open=False):
|
318 |
-
|
319 |
-
|
320 |
with gr.Row():
|
321 |
-
|
322 |
with gr.Column():
|
323 |
-
|
324 |
|
325 |
# Description
|
326 |
gr.Markdown(description_e)
|
@@ -330,12 +330,12 @@ with gr.Blocks(css=css, title='Fast Segment Anything') as demo:
|
|
330 |
segment_btn_e.click(segment_everything,
|
331 |
inputs=[
|
332 |
cond_img_e,
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
contour_check_e,
|
338 |
-
|
339 |
],
|
340 |
outputs=segm_img_e)
|
341 |
|
@@ -347,11 +347,11 @@ with gr.Blocks(css=css, title='Fast Segment Anything') as demo:
|
|
347 |
inputs=[
|
348 |
cond_img_t,
|
349 |
input_size_slider_t,
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
contour_check_t,
|
354 |
-
|
355 |
text_box,
|
356 |
],
|
357 |
outputs=segm_img_t)
|
|
|
189 |
global_points = []
|
190 |
global_point_label = []
|
191 |
|
192 |
+
input_size_slider_e = gr.components.Slider(minimum=512,
|
193 |
maximum=1024,
|
194 |
value=1024,
|
195 |
step=64,
|
|
|
218 |
# Submit & Clear
|
219 |
with gr.Row():
|
220 |
with gr.Column():
|
221 |
+
input_size_slider_e.render()
|
222 |
|
223 |
with gr.Row():
|
224 |
contour_check_e = gr.Checkbox(value=True, label='withContours', info='draw the edges of the masks')
|
|
|
238 |
with gr.Column():
|
239 |
with gr.Accordion("Advanced options", open=False):
|
240 |
# text_box = gr.Textbox(label="text prompt")
|
241 |
+
iou_threshold_e = gr.Slider(0.1, 0.9, 0.7, step=0.1, label='iou', info='iou threshold for filtering the annotations')
|
242 |
+
conf_threshold_e = gr.Slider(0.1, 0.9, 0.25, step=0.05, label='conf', info='object confidence threshold')
|
243 |
with gr.Row():
|
244 |
+
mor_check_e = gr.Checkbox(value=False, label='better_visual_quality', info='better quality using morphologyEx')
|
245 |
with gr.Column():
|
246 |
+
retina_check_e = gr.Checkbox(value=True, label='use_retina', info='draw high-resolution segmentation masks')
|
247 |
# Description
|
248 |
gr.Markdown(description_e)
|
249 |
|
|
|
315 |
|
316 |
with gr.Column():
|
317 |
with gr.Accordion("Advanced options", open=False):
|
318 |
+
iou_threshold_t = gr.Slider(0.1, 0.9, 0.7, step=0.1, label='iou', info='iou threshold for filtering the annotations')
|
319 |
+
conf_threshold_t = gr.Slider(0.1, 0.9, 0.25, step=0.05, label='conf', info='object confidence threshold')
|
320 |
with gr.Row():
|
321 |
+
mor_check_t = gr.Checkbox(value=False, label='better_visual_quality', info='better quality using morphologyEx')
|
322 |
with gr.Column():
|
323 |
+
retina_check_t = gr.Checkbox(value=True, label='use_retina', info='draw high-resolution segmentation masks')
|
324 |
|
325 |
# Description
|
326 |
gr.Markdown(description_e)
|
|
|
330 |
segment_btn_e.click(segment_everything,
|
331 |
inputs=[
|
332 |
cond_img_e,
|
333 |
+
input_size_slider_e,
|
334 |
+
iou_threshold_e,
|
335 |
+
conf_threshold_e,
|
336 |
+
mor_check_e,
|
337 |
contour_check_e,
|
338 |
+
retina_check_e,
|
339 |
],
|
340 |
outputs=segm_img_e)
|
341 |
|
|
|
347 |
inputs=[
|
348 |
cond_img_t,
|
349 |
input_size_slider_t,
|
350 |
+
iou_threshold_t,
|
351 |
+
conf_threshold_t,
|
352 |
+
mor_check_t,
|
353 |
contour_check_t,
|
354 |
+
retina_check_t,
|
355 |
text_box,
|
356 |
],
|
357 |
outputs=segm_img_t)
|