Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -61,6 +61,7 @@ def reverse_mask_image(image: np.ndarray, mask: np.ndarray, gray_value=128):
|
|
61 |
return np.where(mask[..., None], image, gray_color)
|
62 |
|
63 |
|
|
|
64 |
def filter_detections(image_rgb_pil: Image.Image, detections: sv.Detections) -> sv.Detections:
|
65 |
img_rgb_numpy = np.array(image_rgb_pil)
|
66 |
filtering_mask = []
|
@@ -82,7 +83,7 @@ def filter_detections(image_rgb_pil: Image.Image, detections: sv.Detections) ->
|
|
82 |
filtering_mask
|
83 |
)
|
84 |
return detections[filtering_mask]
|
85 |
-
|
86 |
|
87 |
def inference (image_rgb_pil: Image.Image) -> List[Image.Image]:
|
88 |
width, height = image_rgb_pil.size
|
@@ -92,10 +93,12 @@ def inference (image_rgb_pil: Image.Image) -> List[Image.Image]:
|
|
92 |
image_rgb_pil
|
93 |
)
|
94 |
detections = detections[ detections.area /area > MIN_AREA_THRESHOLD ]
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
|
|
|
|
99 |
blank_image = Image.new("RGB", (width, height), "black")
|
100 |
return [
|
101 |
annotate(
|
|
|
61 |
return np.where(mask[..., None], image, gray_color)
|
62 |
|
63 |
|
64 |
+
"""
|
65 |
def filter_detections(image_rgb_pil: Image.Image, detections: sv.Detections) -> sv.Detections:
|
66 |
img_rgb_numpy = np.array(image_rgb_pil)
|
67 |
filtering_mask = []
|
|
|
83 |
filtering_mask
|
84 |
)
|
85 |
return detections[filtering_mask]
|
86 |
+
"""
|
87 |
|
88 |
def inference (image_rgb_pil: Image.Image) -> List[Image.Image]:
|
89 |
width, height = image_rgb_pil.size
|
|
|
93 |
image_rgb_pil
|
94 |
)
|
95 |
detections = detections[ detections.area /area > MIN_AREA_THRESHOLD ]
|
96 |
+
|
97 |
+
#detections = filter_detections(
|
98 |
+
# image_rgb_pil=image_rgb_pil,
|
99 |
+
# detections=detections,
|
100 |
+
#)
|
101 |
+
|
102 |
blank_image = Image.new("RGB", (width, height), "black")
|
103 |
return [
|
104 |
annotate(
|