Spaces:
Runtime error
Runtime error
Update models/detection/detector.py
Browse files
models/detection/detector.py
CHANGED
|
@@ -51,8 +51,10 @@ class ObjectDetector:
|
|
| 51 |
|
| 52 |
def predict(self, image: Image.Image, conf_threshold=0.25):
|
| 53 |
self.load_model()
|
|
|
|
| 54 |
if self.model is None:
|
| 55 |
-
|
|
|
|
| 56 |
results = self.model(image)
|
| 57 |
detections = []
|
| 58 |
for r in results:
|
|
|
|
| 51 |
|
| 52 |
def predict(self, image: Image.Image, conf_threshold=0.25):
|
| 53 |
self.load_model()
|
| 54 |
+
|
| 55 |
if self.model is None:
|
| 56 |
+
raise RuntimeError("YOLO model not loaded. Call load_model() first.")
|
| 57 |
+
|
| 58 |
results = self.model(image)
|
| 59 |
detections = []
|
| 60 |
for r in results:
|