Can't get more info on the runtime error
Browse files
app.py
CHANGED
|
@@ -84,8 +84,14 @@ def detect_objects(model_name,url_input,image_input,threshold):
|
|
| 84 |
for i, box in enumerate(boxes):
|
| 85 |
# r = box.xyxy[0].astype(int)
|
| 86 |
coordinates = box.xyxy[0].astype(int)
|
| 87 |
-
|
| 88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
# final_str_abv += str() + "__" + str(box.cls) + "__" + str(box.conf) + "__" + str(box) + "\n"
|
| 90 |
if confi >= threshold:
|
| 91 |
final_str_abv += f"Detected `{label}` with confidence `{confi}` at location `{coordinates}`\n"
|
|
|
|
| 84 |
for i, box in enumerate(boxes):
|
| 85 |
# r = box.xyxy[0].astype(int)
|
| 86 |
coordinates = box.xyxy[0].astype(int)
|
| 87 |
+
try:
|
| 88 |
+
label = YOLOV8_LABELS[int(box.cls)]
|
| 89 |
+
except:
|
| 90 |
+
label = "ERROR"
|
| 91 |
+
try:
|
| 92 |
+
confi = float(box.conf)
|
| 93 |
+
except:
|
| 94 |
+
confi = 0.0
|
| 95 |
# final_str_abv += str() + "__" + str(box.cls) + "__" + str(box.conf) + "__" + str(box) + "\n"
|
| 96 |
if confi >= threshold:
|
| 97 |
final_str_abv += f"Detected `{label}` with confidence `{confi}` at location `{coordinates}`\n"
|