Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -121,11 +121,10 @@ def analyze_messages(input_text, risk_flags):
|
|
121 |
outputs = model(**inputs)
|
122 |
scores = torch.sigmoid(outputs.logits.squeeze(0)).numpy()
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
]
|
129 |
))
|
130 |
|
131 |
abuse_level = calculate_abuse_level(scores, adjusted_thresholds, motif_hits=[label for label, _ in matched_phrases])
|
|
|
121 |
outputs = model(**inputs)
|
122 |
scores = torch.sigmoid(outputs.logits.squeeze(0)).numpy()
|
123 |
|
124 |
+
threshold_labels = [label for label, score in zip(PATTERN_LABELS, scores[:15]) if score > adjusted_thresholds[label]]
|
125 |
+
phrase_labels = [label for label, _ in matched_phrases]
|
126 |
+
pattern_labels_used = list(set(threshold_labels + phrase_labels))
|
127 |
+
|
|
|
128 |
))
|
129 |
|
130 |
abuse_level = calculate_abuse_level(scores, adjusted_thresholds, motif_hits=[label for label, _ in matched_phrases])
|