Spaces:
Sleeping
Sleeping
Update services/metrics_service.py
Browse files
services/metrics_service.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
-
def update_metrics(
|
| 2 |
-
|
| 3 |
return {
|
| 4 |
-
"
|
| 5 |
-
"total_detected": len(
|
|
|
|
|
|
|
| 6 |
}
|
|
|
|
| 1 |
+
def update_metrics(detected_items):
|
| 2 |
+
items = detected_items if detected_items else []
|
| 3 |
return {
|
| 4 |
+
"items": items,
|
| 5 |
+
"total_detected": len(items),
|
| 6 |
+
"cracks": len([item for item in items if item['type'] == 'crack']),
|
| 7 |
+
"objects": len([item for item in items if item['type'] == 'object'])
|
| 8 |
}
|