KurtLin commited on
Commit
aadd02f
·
1 Parent(s): 0b46ced

Initial Commit

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -36,10 +36,11 @@ def inference(image, input_label, model_choice):
36
  multimask_output=True,
37
  )
38
  mask = masks[0]
 
39
  image2 = image.copy()
40
  image2[mask, 0] = 255
41
  image2[y-10:y+10, x-10:x+10, 2] = 255
42
- return image2
43
 
44
 
45
  my_app = gr.Blocks()
@@ -55,6 +56,7 @@ with my_app:
55
  model_choice = gr.Dropdown(['ViT-base', 'ViT-large', 'ViT-huge'], label='Model Backbone')
56
  infer = gr.Button(label="Segment")
57
  with gr.Column():
 
58
  img_output = gr.Image(label="Output Mask", shape=(1024, 1024))
59
 
60
  img_source.select(get_coords, [], coords)
@@ -66,6 +68,7 @@ with my_app:
66
  model_choice
67
  ],
68
  [
 
69
  img_output
70
  ]
71
  )
 
36
  multimask_output=True,
37
  )
38
  mask = masks[0]
39
+ score = scores[0]
40
  image2 = image.copy()
41
  image2[mask, 0] = 255
42
  image2[y-10:y+10, x-10:x+10, 2] = 255
43
+ return score, image2
44
 
45
 
46
  my_app = gr.Blocks()
 
56
  model_choice = gr.Dropdown(['ViT-base', 'ViT-large', 'ViT-huge'], label='Model Backbone')
57
  infer = gr.Button(label="Segment")
58
  with gr.Column():
59
+ score = gr.Label(label="Mask Confidence")
60
  img_output = gr.Image(label="Output Mask", shape=(1024, 1024))
61
 
62
  img_source.select(get_coords, [], coords)
 
68
  model_choice
69
  ],
70
  [
71
+ score,
72
  img_output
73
  ]
74
  )