Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -244,9 +244,10 @@ def analyze_single_message(text, thresholds):
|
|
244 |
return abuse_score, threshold_labels, top_patterns, result, stage, darvo_score
|
245 |
|
246 |
def analyze_composite(msg1, msg2, msg3, *answers_and_none):
|
247 |
-
|
248 |
-
|
249 |
-
|
|
|
250 |
messages = [msg1, msg2, msg3]
|
251 |
active = [m for m in messages if m.strip()]
|
252 |
if not active:
|
@@ -273,15 +274,11 @@ def analyze_composite(msg1, msg2, msg3, *answers_and_none):
|
|
273 |
darvo_blurb = f"\n\nπ **DARVO Score: {avg_darvo}** β This indicates a **{level} likelihood** of narrative reversal (DARVO), where the speaker may be denying, attacking, or reversing blame."
|
274 |
|
275 |
if none_selected:
|
276 |
-
|
277 |
-
|
278 |
-
escalation_note = "π *This section was not completed. Escalation potential is unknown.*"
|
279 |
else:
|
280 |
-
escalation_score
|
281 |
-
|
282 |
-
level = "High" if escalation_score >= 16 else "Moderate" if escalation_score >= 8 else "Low"
|
283 |
-
escalation_potential = f"{level} ({escalation_score}/{escalation_total})"
|
284 |
-
escalation_note = "π¨ This indicates how many serious risk factors are present based on your answers to the safety checklist."
|
285 |
|
286 |
out = f"Abuse Intensity: {composite_abuse}%\n"
|
287 |
out += "π This reflects the strength and severity of detected abuse patterns in the message(s).\n\n"
|
|
|
244 |
return abuse_score, threshold_labels, top_patterns, result, stage, darvo_score
|
245 |
|
246 |
def analyze_composite(msg1, msg2, msg3, *answers_and_none):
|
247 |
+
none_selected_checked = answers_and_none[-1]
|
248 |
+
responses_checked = any(answers_and_none[:-1])
|
249 |
+
none_selected = not responses_checked and none_selected_checked
|
250 |
+
|
251 |
messages = [msg1, msg2, msg3]
|
252 |
active = [m for m in messages if m.strip()]
|
253 |
if not active:
|
|
|
274 |
darvo_blurb = f"\n\nπ **DARVO Score: {avg_darvo}** β This indicates a **{level} likelihood** of narrative reversal (DARVO), where the speaker may be denying, attacking, or reversing blame."
|
275 |
|
276 |
if none_selected:
|
277 |
+
out += "Escalation Potential: Unknown (Checklist not completed)\n"
|
278 |
+
out += "π *This section was not completed. Escalation potential is unknown.*\n\n"
|
|
|
279 |
else:
|
280 |
+
out += f"Escalation Potential: {('High' if escalation_score >= 16 else 'Moderate' if escalation_score >= 8 else 'Low')} ({escalation_score}/{sum(w for _, w in ESCALATION_QUESTIONS)})\n"
|
281 |
+
out += "π¨ This indicates how many serious risk factors are present based on your answers to the safety checklist.\n\n"
|
|
|
|
|
|
|
282 |
|
283 |
out = f"Abuse Intensity: {composite_abuse}%\n"
|
284 |
out += "π This reflects the strength and severity of detected abuse patterns in the message(s).\n\n"
|