SamanthaStorm commited on
Commit
6d4f10f
·
verified ·
1 Parent(s): dcb0de6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -140,7 +140,15 @@ def analyze_messages(input_text, risk_flags):
140
 
141
  if non_abusive_confident and danger_flag_count == 0 and not matched_phrases:
142
  return "This message is classified as non-abusive."
143
-
 
 
 
 
 
 
 
 
144
  scored_patterns = [
145
  (label, score) for label, score in zip(PATTERN_LABELS, scores[:15]) if label != "non_abusive"
146
  ]
 
140
 
141
  if non_abusive_confident and danger_flag_count == 0 and not matched_phrases:
142
  return "This message is classified as non-abusive."
143
+ # Supportive override logic
144
+ if (
145
+ sentiment_label == "supportive"
146
+ and sentiment_score > 0.95
147
+ and non_abusive_confident
148
+ and danger_flag_count == 0
149
+ and not matched_phrases
150
+ ):
151
+ return "This message is classified as non-abusive. It appears emotionally supportive and safe."
152
  scored_patterns = [
153
  (label, score) for label, score in zip(PATTERN_LABELS, scores[:15]) if label != "non_abusive"
154
  ]