SamanthaStorm commited on
Commit
dd85bbd
·
verified ·
1 Parent(s): d97af8c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -137,19 +137,17 @@ def analyze_messages(input_text, risk_flags):
137
  )
138
 
139
  # THEN immediately follow with this:
140
- if motif_flags:
141
- result += "\n\n🧠 Motif Tags:\n" + "\n".join([f"• {flag}" for flag in motif_flags])
142
-
143
  if contextual_flags:
144
- result += "\n\n⚠️ You indicated the following:\n" + "\n".join([f"• {flag}" for flag in contextual_flags])
145
 
146
  if high_risk_context:
147
  result += "\n\n🚨 These responses suggest a high-risk situation. Consider seeking immediate help or safety planning resources."
148
 
149
  if matched_phrases:
150
  result += "\n\n🚨 Detected High-Risk Phrases:\n"
151
- for label, phrase in matched_phrases:
152
- result += f"• {label.replace('_', ' ').title()}: \"{phrase}\"\n"
 
153
  return result
154
 
155
  iface = gr.Interface(
 
137
  )
138
 
139
  # THEN immediately follow with this:
 
 
 
140
  if contextual_flags:
141
+ result += "\n\n⚠️ You indicated the following:\n" + "\n".join([f"• {flag.replace('_', ' ').title()}" for flag in contextual_flags])
142
 
143
  if high_risk_context:
144
  result += "\n\n🚨 These responses suggest a high-risk situation. Consider seeking immediate help or safety planning resources."
145
 
146
  if matched_phrases:
147
  result += "\n\n🚨 Detected High-Risk Phrases:\n"
148
+ for label, phrase in matched_phrases:
149
+ phrase_clean = phrase.replace('"', "'").strip()
150
+ result += f"• {label.replace('_', ' ').title()}: “{phrase_clean}”\n"
151
  return result
152
 
153
  iface = gr.Interface(