Junfeng5 commited on
Commit
ca7570a
1 Parent(s): f420473

Update app.py

Browse files

fix examples bug

Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -1136,9 +1136,9 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
1136
  'For interactive segmentation:<br />\
1137
  1.Draw points, boxes, or scribbles on the canvas for multiclass segmentation; use separate layers for different objects, adding layers with a "+" sign.<br />\
1138
  2.Point mode accepts a single point only; multiple points default to the centroid, so use boxes or scribbles for larger objects.<br />\
1139
- 3.After drawing, click green "" to preview the prompt visualization; the segmentation mask follows the chosen prompt colors.'
1140
  )
1141
-
1142
  img_showbox = gr.Image(label="visual prompt area preview")
1143
 
1144
 
@@ -1215,7 +1215,8 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
1215
 
1216
 
1217
  image_button = gr.Button("Detect & Segment")
1218
- img_input.change(visual_prompt_preview, inputs = [img_input,prompt_mode_select] , outputs = img_showbox)
 
1219
  image_button.click(segment_image, inputs=[img_input, prompt_mode_select, category_select, custom_category,input_expressiong, results_select, num_inst_select, threshold_select, mask_image_mix_ration,model_select], outputs=image_segment)
1220
  gr.Examples(
1221
  examples = image_example_list,
 
1136
  'For interactive segmentation:<br />\
1137
  1.Draw points, boxes, or scribbles on the canvas for multiclass segmentation; use separate layers for different objects, adding layers with a "+" sign.<br />\
1138
  2.Point mode accepts a single point only; multiple points default to the centroid, so use boxes or scribbles for larger objects.<br />\
1139
+ 3.After drawing, you can click "preview" button to preview the prompt visualization, but need redraw it again for segmentation; the segmentation mask follows the chosen prompt colors.'
1140
  )
1141
+ image_preview_button = gr.Button("preview & redraw")
1142
  img_showbox = gr.Image(label="visual prompt area preview")
1143
 
1144
 
 
1215
 
1216
 
1217
  image_button = gr.Button("Detect & Segment")
1218
+ image_preview_button.click(visual_prompt_preview, inputs = [img_input,prompt_mode_select] , outputs = img_showbox)
1219
+ # img_input.change(visual_prompt_preview, inputs = [img_input,prompt_mode_select] , outputs = img_showbox)
1220
  image_button.click(segment_image, inputs=[img_input, prompt_mode_select, category_select, custom_category,input_expressiong, results_select, num_inst_select, threshold_select, mask_image_mix_ration,model_select], outputs=image_segment)
1221
  gr.Examples(
1222
  examples = image_example_list,