Spaces:
Runtime error
Runtime error
Rename detection_service.py to services/detection_service.py
Browse files
detection_service.py → services/detection_service.py
RENAMED
@@ -1,9 +1,11 @@
|
|
1 |
from transformers import pipeline
|
2 |
import cv2
|
3 |
|
|
|
4 |
object_detector = pipeline("object-detection", model="facebook/detr-resnet-50")
|
5 |
|
6 |
def detect_objects(image_path):
|
7 |
image = cv2.imread(image_path)
|
8 |
results = object_detector(image)
|
9 |
-
|
|
|
|
1 |
from transformers import pipeline
|
2 |
import cv2
|
3 |
|
4 |
+
# Load DETR model
|
5 |
object_detector = pipeline("object-detection", model="facebook/detr-resnet-50")
|
6 |
|
7 |
def detect_objects(image_path):
|
8 |
image = cv2.imread(image_path)
|
9 |
results = object_detector(image)
|
10 |
+
high_conf = [r for r in results if r['score'] > 0.8]
|
11 |
+
return high_conf
|