Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
# Define
|
4 |
patterns = [
|
5 |
{
|
6 |
"id": "identity_erosion_001",
|
@@ -32,9 +32,23 @@ patterns = [
|
|
32 |
"insight": "Frequent required check-ins can signal coercive oversight or fear-based compliance.",
|
33 |
"escalation": "High"
|
34 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
]
|
36 |
|
37 |
-
#
|
38 |
def analyze_input(text, role):
|
39 |
role_key = "therapist" if role == "Therapist" else "cop"
|
40 |
input_text = text.lower()
|
@@ -52,7 +66,7 @@ def analyze_input(text, role):
|
|
52 |
return "No clear abuse pattern detected. Continue listening for contradictions, self-blame, or fear-based justifications."
|
53 |
return "\n\n".join(results)
|
54 |
|
55 |
-
#
|
56 |
gr.Interface(
|
57 |
fn=analyze_input,
|
58 |
inputs=[
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
# Define detection patterns
|
4 |
patterns = [
|
5 |
{
|
6 |
"id": "identity_erosion_001",
|
|
|
32 |
"insight": "Frequent required check-ins can signal coercive oversight or fear-based compliance.",
|
33 |
"escalation": "High"
|
34 |
},
|
35 |
+
{
|
36 |
+
"id": "lethal_intimidation_001",
|
37 |
+
"name": "Excessive Weapon Presence or Intimidation",
|
38 |
+
"trigger_keywords": [
|
39 |
+
"guns in the house", "keeps a knife on him", "built his own gun",
|
40 |
+
"gun isn’t locked", "open carry at home", "he always wears his knife",
|
41 |
+
"refused to put guns in a safe", "too many weapons", "it makes me nervous"
|
42 |
+
],
|
43 |
+
"concern": "Implied threat or coercive intimidation via weapon access",
|
44 |
+
"follow_up_therapist": "How do you feel about the weapons being kept around — is that something you’re okay with?",
|
45 |
+
"follow_up_cop": "Has there ever been a time where the presence of those weapons made you feel unsafe or changed how you responded in an argument?",
|
46 |
+
"insight": "Unsafely stored or emotionally charged weapon presence can signal power imbalances, intimidation, and elevated risk of harm — especially when one partner is uncomfortable but compliance continues.",
|
47 |
+
"escalation": "High"
|
48 |
+
}
|
49 |
]
|
50 |
|
51 |
+
# Detection function
|
52 |
def analyze_input(text, role):
|
53 |
role_key = "therapist" if role == "Therapist" else "cop"
|
54 |
input_text = text.lower()
|
|
|
66 |
return "No clear abuse pattern detected. Continue listening for contradictions, self-blame, or fear-based justifications."
|
67 |
return "\n\n".join(results)
|
68 |
|
69 |
+
# Gradio UI
|
70 |
gr.Interface(
|
71 |
fn=analyze_input,
|
72 |
inputs=[
|