SamanthaStorm commited on
Commit
2386279
·
verified ·
1 Parent(s): 207a539

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -401,7 +401,9 @@ def analyze_single_message(text, thresholds):
401
  "recovery phase", "obscure language"
402
  ]
403
 
404
- label_scores = {label: score for label, score in zip(LABELS, scores)}
 
 
405
  label = score_to_label(score) if score is not None else "Unknown"
406
 
407
  # 🛡️ Prevent obscure language from being chosen unless it crosses a hard threshold
 
401
  "recovery phase", "obscure language"
402
  ]
403
 
404
+ # Use top_label from earlier safely, and convert to score if available
405
+ label_key = top_label.split(" = ")[0] # Extract raw label (e.g., "Control" from "Control = 78%")
406
+ score = label_scores.get(label_key)
407
  label = score_to_label(score) if score is not None else "Unknown"
408
 
409
  # 🛡️ Prevent obscure language from being chosen unless it crosses a hard threshold