SamanthaStorm commited on
Commit
197c0d3
·
verified ·
1 Parent(s): 5c011d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -186,8 +186,11 @@ def generate_risk_snippet(abuse_score, top_label, escalation_score, stage):
186
  risk_level = "moderate" # 🔧 New rule for escalation stage
187
  else:
188
  risk_level = "low"
189
- pattern_label = top_label.split(" – ")[0]
190
- pattern_score = top_label.split(" – ")[1] if " – " in top_label else ""
 
 
 
191
 
192
  WHY_FLAGGED = {
193
  "control": "This message may reflect efforts to restrict someone’s autonomy, even if it's framed as concern or care.",
 
186
  risk_level = "moderate" # 🔧 New rule for escalation stage
187
  else:
188
  risk_level = "low"
189
+ if isinstance(top_label, str) and " – " in top_label:
190
+ pattern_label, pattern_score = top_label.split(" – ")
191
+ else:
192
+ pattern_label = str(top_label) if top_label is not None else "Unknown"
193
+ pattern_score = ""
194
 
195
  WHY_FLAGGED = {
196
  "control": "This message may reflect efforts to restrict someone’s autonomy, even if it's framed as concern or care.",