Martin Tomov commited on
Commit
53a464b
Β·
verified Β·
1 Parent(s): 61fa334

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -185,9 +185,7 @@ def draw_classification_boxes(image_with_insects, detections):
185
  )
186
  return image_with_insects
187
 
188
- def process_image(image=None):
189
- if image is None:
190
- image = load_image("https://i.imgur.com/qZOnNAC.jpeg")
191
  labels = ["insect"]
192
  original_image, detections = grounded_segmentation(image, labels, threshold=0.3, polygon_refinement=True)
193
  annotated_image = plot_detections(original_image, detections)
@@ -197,8 +195,7 @@ def process_image(image=None):
197
 
198
  gr.Interface(
199
  fn=process_image,
200
- inputs=gr.Image(type="pil", label="Input Image"),
201
- outputs=[gr.Image(type="numpy", label="Annotated Image"), gr.Image(type="numpy", label="Yellow Background with Insects")],
202
  title="🐞 InsectSAM + GroundingDINO Inference",
203
- examples=["https://i.imgur.com/qZOnNAC.jpeg"]
204
- ).launch()
 
185
  )
186
  return image_with_insects
187
 
188
+ def process_image(image):
 
 
189
  labels = ["insect"]
190
  original_image, detections = grounded_segmentation(image, labels, threshold=0.3, polygon_refinement=True)
191
  annotated_image = plot_detections(original_image, detections)
 
195
 
196
  gr.Interface(
197
  fn=process_image,
198
+ inputs=gr.Image(type="pil"),
199
+ outputs=[gr.Image(type="numpy"), gr.Image(type="numpy")],
200
  title="🐞 InsectSAM + GroundingDINO Inference",
201
+ ).launch()