Spaces:
Runtime error
Runtime error
napatswift
commited on
Commit
·
5242954
1
Parent(s):
567c46b
Update app and weights
Browse files- main.py +3 -8
- model/table-det/model.pth +2 -2
main.py
CHANGED
@@ -84,21 +84,16 @@ def predict(image_input):
|
|
84 |
# Inference the tables in the image.
|
85 |
result = inference_detector(table_det, image_input)
|
86 |
|
87 |
-
# Create a list to store the bounding boxes.
|
88 |
-
bbox_list = []
|
89 |
-
|
90 |
# Get the masks of the tables.
|
91 |
mask_images = result.pred_instances.masks.cpu().numpy()
|
92 |
scores = result.pred_instances.scores.cpu().numpy()
|
93 |
|
94 |
-
#
|
95 |
-
mask_images = mask_images[scores > 0.5]
|
96 |
-
|
97 |
if len(mask_images) == 0:
|
98 |
return []
|
99 |
|
100 |
-
#
|
101 |
-
mask_image =
|
102 |
|
103 |
return get_bbox(mask_image.astype(np.uint8))
|
104 |
|
|
|
84 |
# Inference the tables in the image.
|
85 |
result = inference_detector(table_det, image_input)
|
86 |
|
|
|
|
|
|
|
87 |
# Get the masks of the tables.
|
88 |
mask_images = result.pred_instances.masks.cpu().numpy()
|
89 |
scores = result.pred_instances.scores.cpu().numpy()
|
90 |
|
91 |
+
# If there are no tables, return an empty list.
|
|
|
|
|
92 |
if len(mask_images) == 0:
|
93 |
return []
|
94 |
|
95 |
+
# Get mask with highest score
|
96 |
+
mask_image = mask_images[scores.argmax()]
|
97 |
|
98 |
return get_bbox(mask_image.astype(np.uint8))
|
99 |
|
model/table-det/model.pth
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5e04ce5891ea3c2675b2b4b35268663b85f8a732c43844d912209c68cc4903d3
|
3 |
+
size 351141001
|