Spaces:
Running
on
Zero
Running
on
Zero
Martin Tomov
commited on
Update app.py
Browse files
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
|
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"
|
201 |
-
outputs=[gr.Image(type="numpy"
|
202 |
title="π InsectSAM + GroundingDINO Inference",
|
203 |
-
|
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()
|
|