Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -79,17 +79,20 @@ def get_detection(img_path):
|
|
79 |
(image_scale-new_size[1])//2))
|
80 |
pred_dict = model_type.end2end_detect(new_im, valid_tfms, model, class_map=class_map, detection_threshold=0.6)
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
labels
|
85 |
-
|
86 |
-
|
87 |
-
labels
|
88 |
-
|
89 |
-
|
90 |
-
labels
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
93 |
|
94 |
def get_img_detection(img_path):
|
95 |
|
|
|
79 |
(image_scale-new_size[1])//2))
|
80 |
pred_dict = model_type.end2end_detect(new_im, valid_tfms, model, class_map=class_map, detection_threshold=0.6)
|
81 |
|
82 |
+
if (len(pred_dict['detection']['labels'])) > 0:
|
83 |
+
num_count = 1
|
84 |
+
for i,j in zip(pred_dict['detection']['labels'], pred_dict['detection']['scores']):
|
85 |
+
labels = i
|
86 |
+
acc = round((j*100),2)
|
87 |
+
if labels == "Neg":
|
88 |
+
labels = "Negative"
|
89 |
+
st.success(f"{num_count}. '{labels}' with {acc} % confidence.")
|
90 |
+
elif labels == "Pos":
|
91 |
+
labels = "Positive"
|
92 |
+
st.error(f"{num_count}. '{labels}' with {acc} % confidence.")
|
93 |
+
num_count += 1
|
94 |
+
else: # when not found imgs
|
95 |
+
st.warning("Not found 'Antigen Test Kit' image ; please recheck and try again !!")
|
96 |
|
97 |
def get_img_detection(img_path):
|
98 |
|