Martin Tomov commited on
Commit
02e5a68
Β·
verified Β·
1 Parent(s): 225e1f4

example added

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -197,13 +197,18 @@ def process_image(image):
197
  yellow_background_with_insects = create_yellow_background_with_insects(np.array(original_image), detections)
198
  detections_json = detections_to_json(detections)
199
  json_output_path = "insect_detections.json"
200
- with open(json_output_path, 'w') as json_file:
201
  json.dump(detections_json, json_file, indent=4)
202
  return yellow_background_with_insects, json.dumps(detections_json, separators=(',', ':'))
203
 
 
 
 
 
204
  gr.Interface(
205
  fn=process_image,
206
  inputs=gr.Image(type="pil"),
207
  outputs=[gr.Image(type="numpy"), gr.Textbox()],
208
- title="🐞 InsectSAM + GroundingDINO Inference",
209
- ).launch()
 
 
197
  yellow_background_with_insects = create_yellow_background_with_insects(np.array(original_image), detections)
198
  detections_json = detections_to_json(detections)
199
  json_output_path = "insect_detections.json"
200
+ with open(json_output_path, 'w') as json_file,
201
  json.dump(detections_json, json_file, indent=4)
202
  return yellow_background_with_insects, json.dumps(detections_json, separators=(',', ':'))
203
 
204
+ examples = [
205
+ ["flower-night.jpg"]
206
+ ]
207
+
208
  gr.Interface(
209
  fn=process_image,
210
  inputs=gr.Image(type="pil"),
211
  outputs=[gr.Image(type="numpy"), gr.Textbox()],
212
+ title="InsectSAM 🐞 + GroundingDINO Inference",
213
+ examples=examples
214
+ ).launch()