Spaces:
Running
on
Zero
Running
on
Zero
Martin Tomov
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,3 @@
|
|
1 |
-
import os
|
2 |
-
os.system('pip install gradio==4.29.0')
|
3 |
-
|
4 |
import random
|
5 |
from dataclasses import dataclass
|
6 |
from typing import Any, List, Dict, Optional, Union, Tuple
|
@@ -183,7 +180,7 @@ def draw_classification_boxes(image_with_insects: np.ndarray, detections: List[D
|
|
183 |
return image_with_insects
|
184 |
|
185 |
def process_image(image):
|
186 |
-
labels = ["
|
187 |
original_image, detections = grounded_segmentation(image, labels, threshold=0.3, polygon_refinement=True)
|
188 |
masked_image = plot_detections(original_image, detections)
|
189 |
insect_masks = extract_insect_masks(original_image, detections)
|
@@ -196,5 +193,5 @@ gr.Interface(
|
|
196 |
fn=process_image,
|
197 |
inputs=gr.Image(type="pil"),
|
198 |
outputs=[gr.Image(type="numpy"), gr.Image(type="numpy"), gr.Image(type="numpy")],
|
199 |
-
title="Insect Detection and Masking"
|
200 |
).launch()
|
|
|
|
|
|
|
|
|
1 |
import random
|
2 |
from dataclasses import dataclass
|
3 |
from typing import Any, List, Dict, Optional, Union, Tuple
|
|
|
180 |
return image_with_insects
|
181 |
|
182 |
def process_image(image):
|
183 |
+
labels = ["insect"]
|
184 |
original_image, detections = grounded_segmentation(image, labels, threshold=0.3, polygon_refinement=True)
|
185 |
masked_image = plot_detections(original_image, detections)
|
186 |
insect_masks = extract_insect_masks(original_image, detections)
|
|
|
193 |
fn=process_image,
|
194 |
inputs=gr.Image(type="pil"),
|
195 |
outputs=[gr.Image(type="numpy"), gr.Image(type="numpy"), gr.Image(type="numpy")],
|
196 |
+
title="🐞 Insect Detection and Masking"
|
197 |
).launch()
|