Spaces:
Sleeping
Sleeping
Martin Tomov
commited on
example added
Browse files
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="π
|
209 |
-
|
|
|
|
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()
|