Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -104,9 +104,17 @@ def analyze_composite(msg1, msg2, msg3, flags):
|
|
104 |
|
105 |
# Adjust flag-based weight relative to number of messages
|
106 |
danger_weight = 5
|
107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
composite_score = min(base_score + flag_boost, 100)
|
109 |
composite_score = round(composite_score, 2)
|
|
|
110 |
|
111 |
result = f"These messages show patterns of {', '.join(label for label, _ in top_labels)} and are estimated to be {composite_score}% likely abusive."
|
112 |
for expl in top_explanations:
|
|
|
104 |
|
105 |
# Adjust flag-based weight relative to number of messages
|
106 |
danger_weight = 5
|
107 |
+
flag_weights = {
|
108 |
+
"They've threatened harm": 6,
|
109 |
+
"They isolate me": 5,
|
110 |
+
"I’ve changed my behavior out of fear": 4,
|
111 |
+
"They monitor/follow me": 4,
|
112 |
+
"I feel unsafe when alone with them": 6
|
113 |
+
}
|
114 |
+
flag_boost = sum(flag_weights.get(f, 3) for f in flags) / len(active_messages)
|
115 |
composite_score = min(base_score + flag_boost, 100)
|
116 |
composite_score = round(composite_score, 2)
|
117 |
+
composite_score = round(composite_score)
|
118 |
|
119 |
result = f"These messages show patterns of {', '.join(label for label, _ in top_labels)} and are estimated to be {composite_score}% likely abusive."
|
120 |
for expl in top_explanations:
|