Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ model_version = int(os.getenv("ROBOFLOW_MODEL_VERSION"))
|
|
19 |
|
20 |
# OWLv2 Config
|
21 |
OWLV2_API_KEY = os.getenv("COUNTGD_API_KEY")
|
22 |
-
OWLV2_PROMPTS = ["beverage", "bottle", "cans", "
|
23 |
|
24 |
# Inisialisasi Model YOLO
|
25 |
rf = Roboflow(api_key=rf_api_key)
|
@@ -101,7 +101,7 @@ def detect_combined(image):
|
|
101 |
# Gambar bounding box untuk kompetitor (Merah) dengan label 'unclassified' jika sesuai
|
102 |
for comp in competitor_boxes:
|
103 |
x1, y1, x2, y2 = comp['box']
|
104 |
-
unclassified_classes = ["beverage", "bottle", "cans", "
|
105 |
display_name = "unclassified" if any(cls in comp['class'].lower() for cls in unclassified_classes) else comp['class']
|
106 |
cv2.rectangle(img, (int(x1), int(y1)), (int(x2), int(y2)), (0, 0, 255), 2)
|
107 |
cv2.putText(img, f"{display_name} {comp['confidence']:.2f}",
|
|
|
19 |
|
20 |
# OWLv2 Config
|
21 |
OWLV2_API_KEY = os.getenv("COUNTGD_API_KEY")
|
22 |
+
OWLV2_PROMPTS = ["beverage", "bottle", "cans", "tetra pak", "carton drink"]
|
23 |
|
24 |
# Inisialisasi Model YOLO
|
25 |
rf = Roboflow(api_key=rf_api_key)
|
|
|
101 |
# Gambar bounding box untuk kompetitor (Merah) dengan label 'unclassified' jika sesuai
|
102 |
for comp in competitor_boxes:
|
103 |
x1, y1, x2, y2 = comp['box']
|
104 |
+
unclassified_classes = ["beverage", "bottle", "cans", "tetra pak", "carton drink"]
|
105 |
display_name = "unclassified" if any(cls in comp['class'].lower() for cls in unclassified_classes) else comp['class']
|
106 |
cv2.rectangle(img, (int(x1), int(y1)), (int(x2), int(y2)), (0, 0, 255), 2)
|
107 |
cv2.putText(img, f"{display_name} {comp['confidence']:.2f}",
|