SamanthaStorm commited on
Commit
1cd3a3a
·
verified ·
1 Parent(s): 6297c04

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -173,17 +173,17 @@ def analyze_messages(input_text, risk_flags):
173
  result += f"🧠 Sentiment: {sentiment_label.title()} (Confidence: {sentiment_score*100:.2f}%)\n"
174
 
175
  # Always include these if available:
176
- if contextual_flags:
177
- result += "\n\n⚠️ You indicated the following:\n" + "\n".join([f"• {flag.replace('_', ' ').title()}" for flag in contextual_flags])
178
 
179
- if high_risk_context:
180
- result += "\n\n🚨 These responses suggest a high-risk situation. Consider seeking immediate help or safety planning resources."
181
 
182
- if matched_phrases:
183
- result += "\n\n🚨 Detected High-Risk Phrases:\n"
184
- for label, phrase in matched_phrases:
185
- phrase_clean = phrase.replace('"', "'").strip()
186
- result += f"• {label.replace('_', ' ').title()}: “{phrase_clean}”\n"
187
 
188
  # Always show abuse type if available
189
 
 
173
  result += f"🧠 Sentiment: {sentiment_label.title()} (Confidence: {sentiment_score*100:.2f}%)\n"
174
 
175
  # Always include these if available:
176
+ if contextual_flags:
177
+ result += "\n\n⚠️ You indicated the following:\n" + "\n".join([f"• {flag.replace('_', ' ').title()}" for flag in contextual_flags])
178
 
179
+ if high_risk_context:
180
+ result += "\n\n🚨 These responses suggest a high-risk situation. Consider seeking immediate help or safety planning resources."
181
 
182
+ if matched_phrases:
183
+ result += "\n\n🚨 Detected High-Risk Phrases:\n"
184
+ for label, phrase in matched_phrases:
185
+ phrase_clean = phrase.replace('"', "'").strip()
186
+ result += f"• {label.replace('_', ' ').title()}: “{phrase_clean}”\n"
187
 
188
  # Always show abuse type if available
189