Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,10 @@ def yolo_inference(input_type, image, video, model_id, conf_threshold, iou_thres
|
|
| 16 |
Accepts detect/seg/pose/obb/cls checkpoints and renders r.plot().
|
| 17 |
"""
|
| 18 |
model = YOLO(model_id)
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
| 20 |
if input_type == "Image":
|
| 21 |
if image is None:
|
| 22 |
w, h = 640, 480
|
|
|
|
| 16 |
Accepts detect/seg/pose/obb/cls checkpoints and renders r.plot().
|
| 17 |
"""
|
| 18 |
model = YOLO(model_id)
|
| 19 |
+
if getattr(model, "task", None) != "classify":
|
| 20 |
+
head = model.model.model[-1]
|
| 21 |
+
if hasattr(head, "one2one_cv2"):
|
| 22 |
+
delattr(head, "one2one_cv2")
|
| 23 |
if input_type == "Image":
|
| 24 |
if image is None:
|
| 25 |
w, h = 640, 480
|