Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -129,21 +129,27 @@ def analyze_messages(input_text, risk_flags):
|
|
129 |
])
|
130 |
|
131 |
result = (
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
|
|
138 |
|
139 |
if contextual_flags:
|
140 |
result += "\n\n⚠️ You indicated the following:\n" + "\n".join([f"• {flag}" for flag in contextual_flags])
|
|
|
141 |
if high_risk_context:
|
142 |
result += "\n\n🚨 These responses suggest a high-risk situation. Consider seeking immediate help or safety planning resources."
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
|
|
147 |
return result
|
148 |
|
149 |
iface = gr.Interface(
|
|
|
129 |
])
|
130 |
|
131 |
result = (
|
132 |
+
f"Abuse Risk Score: {abuse_level}% – {abuse_description}\n\n"
|
133 |
+
f"Most Likely Patterns:\n{top_pattern_explanations}\n\n"
|
134 |
+
f"⚠️ Critical Danger Flags Detected: {danger_flag_count} of 3\n"
|
135 |
+
"Resources: " + resources + "\n\n"
|
136 |
+
f"Sentiment: {sentiment_label.title()} (Confidence: {sentiment_score*100:.2f}%)"
|
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(
|