SamanthaStorm commited on
Commit
252a66b
·
verified ·
1 Parent(s): 42d279c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -122,10 +122,9 @@ def analyze_messages(input_text, risk_flags):
122
  scores = torch.sigmoid(outputs.logits.squeeze(0)).numpy()
123
 
124
  pattern_labels_used = list(set(
125
- [label for label, score in zip(PATTERN_LABELS, scores[:15]) if score > adjusted_thresholds[label]] +
126
- matched_phrases = [
127
- label for label in PATTERN_LABELS
128
- if label.lower() in normalized_text
129
  ]
130
  ))
131
 
 
122
  scores = torch.sigmoid(outputs.logits.squeeze(0)).numpy()
123
 
124
  pattern_labels_used = list(set(
125
+ threshold_labels = [label for label, score in zip(PATTERN_LABELS, scores[:15]) if score > adjusted_thresholds[label]]
126
+ phrase_labels = [label for label, _ in matched_phrases]
127
+ pattern_labels_used = list(set(threshold_labels + phrase_labels))
 
128
  ]
129
  ))
130