tannuiscoding commited on
Commit
0f28ff9
·
1 Parent(s): 8559887

Fix JSON serialization of numpy floats in ML predictions

Browse files
Files changed (1) hide show
  1. backend/ml/ml_engine.py +3 -3
backend/ml/ml_engine.py CHANGED
@@ -309,11 +309,11 @@ def predict(
309
 
310
  return {
311
  "psycho_label": psycho_label,
312
- "psycho_score": round(psycho_score, 4) if psycho_score is not None else None,
313
  "text_label": text_label,
314
- "text_score": round(text_score, 4) if text_score is not None else None,
315
  "fused_label": fused_label,
316
- "fused_score": round(fused_score, 4),
317
  "modality_used": modality_used,
318
  }
319
 
 
309
 
310
  return {
311
  "psycho_label": psycho_label,
312
+ "psycho_score": round(float(psycho_score), 4) if psycho_score is not None else None,
313
  "text_label": text_label,
314
+ "text_score": round(float(text_score), 4) if text_score is not None else None,
315
  "fused_label": fused_label,
316
+ "fused_score": round(float(fused_score), 4),
317
  "modality_used": modality_used,
318
  }
319