Tanaanan commited on
Commit
dd1c7ae
·
1 Parent(s): e8f128f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -11
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
- num_count = 1
83
- for i,j in zip(pred_dict['detection']['labels'], pred_dict['detection']['scores']):
84
- labels = i
85
- acc = round((j*100),2)
86
- if labels == "Neg":
87
- labels = "Negative"
88
- st.success(f"{num_count}. '{labels}' with {acc} % confidence.")
89
- elif labels == "Pos":
90
- labels = "Positive"
91
- st.error(f"{num_count}. '{labels}' with {acc} % confidence.")
92
- num_count += 1
 
 
 
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