Spaces:
Sleeping
Sleeping
Update app.py
#1
by Ritesh2342 - opened
app.py
CHANGED
|
@@ -99,7 +99,10 @@ def run_inference(model, pil_image):
|
|
| 99 |
for box in boxes:
|
| 100 |
# ultralytics Box object fields depend on package version; defensive access:
|
| 101 |
try:
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
| 103 |
except Exception:
|
| 104 |
xyxy = getattr(box, "xyxy", None)
|
| 105 |
if xyxy is None:
|
|
|
|
| 99 |
for box in boxes:
|
| 100 |
# ultralytics Box object fields depend on package version; defensive access:
|
| 101 |
try:
|
| 102 |
+
xyxy = box.xyxy.cpu().numpy().tolist()
|
| 103 |
+
if isinstance(xyxy[0], list):
|
| 104 |
+
xyxy = xyxy[0]
|
| 105 |
+
|
| 106 |
except Exception:
|
| 107 |
xyxy = getattr(box, "xyxy", None)
|
| 108 |
if xyxy is None:
|