Spaces:
Sleeping
Sleeping
fix AI model json
Browse files- telecom_anomaly/api.py +7 -1
telecom_anomaly/api.py
CHANGED
|
@@ -273,9 +273,15 @@ def _run_analysis(
|
|
| 273 |
|
| 274 |
return {
|
| 275 |
"filename": original_filename,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 276 |
"statistics": (
|
| 277 |
stats.to_dict()
|
| 278 |
-
if
|
| 279 |
else {"total_rows": len(detector.data)}
|
| 280 |
),
|
| 281 |
"results": response_records,
|
|
|
|
| 273 |
|
| 274 |
return {
|
| 275 |
"filename": original_filename,
|
| 276 |
+
# Full stats whenever ANY detection ran (rules or model). The
|
| 277 |
+
# stripped `{"total_rows": …}` shape is reserved for the
|
| 278 |
+
# clustering-only / preview pass, where there are no anomalies
|
| 279 |
+
# to summarise. Without this, AI-only mode silently dropped
|
| 280 |
+
# rows_with_anomalies / anomaly_rate / anomaly_types from the
|
| 281 |
+
# response.
|
| 282 |
"statistics": (
|
| 283 |
stats.to_dict()
|
| 284 |
+
if any_detection
|
| 285 |
else {"total_rows": len(detector.data)}
|
| 286 |
),
|
| 287 |
"results": response_records,
|