Spaces:
Runtime error
Runtime error
Commit ·
bf86ee9
1
Parent(s): 8798510
Update app.py
Browse files
app.py
CHANGED
|
@@ -131,25 +131,25 @@ def predict_beetle(img):
|
|
| 131 |
image_edge_buffer=50)
|
| 132 |
image_lst = pre_process.col_image_lst
|
| 133 |
print("Objects detected")
|
| 134 |
-
# get predictions for all segments
|
| 135 |
-
conf_dict_lst = []
|
| 136 |
-
output_lst = []
|
| 137 |
-
img_cnt = len(image_lst)
|
| 138 |
-
for i in range(0,img_cnt):
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
return(
|
| 153 |
|
| 154 |
|
| 155 |
# gradio app
|
|
|
|
| 131 |
image_edge_buffer=50)
|
| 132 |
image_lst = pre_process.col_image_lst
|
| 133 |
print("Objects detected")
|
| 134 |
+
# # get predictions for all segments
|
| 135 |
+
# conf_dict_lst = []
|
| 136 |
+
# output_lst = []
|
| 137 |
+
# img_cnt = len(image_lst)
|
| 138 |
+
# for i in range(0,img_cnt):
|
| 139 |
+
# prob_ar = np.array(bc_model.predict(image_lst[i])[2])
|
| 140 |
+
# print(f"Beetle classified - {i}")
|
| 141 |
+
# unkown_prob = unkown_prob_calc(probs=prob_ar, wedge_threshold=0.85, wedge_magnitude=5, wedge='dynamic')
|
| 142 |
+
# prob_ar = np.append(prob_ar, unkown_prob)
|
| 143 |
+
# prob_ar = np.around(prob_ar*100, decimals=1)
|
| 144 |
+
# # only show the top 5 predictions
|
| 145 |
+
# # Sorting the dictionary by value in descending order and taking the top items
|
| 146 |
+
# top_num = 3
|
| 147 |
+
# conf_dict = {labels[i]: float(prob_ar[i]) for i in range(len(prob_ar))}
|
| 148 |
+
# conf_dict = dict(sorted(conf_dict.items(), key=lambda item: item[1], reverse=True)[:top_num])
|
| 149 |
+
# conf_dict_lst.append(str(conf_dict)[1:-1]) # remove dictionary brackets
|
| 150 |
+
# result = list(zip(image_lst, conf_dict_lst))
|
| 151 |
+
# print(f"Classification processed - {i}")
|
| 152 |
+
return(image_lst)
|
| 153 |
|
| 154 |
|
| 155 |
# gradio app
|