SamanthaStorm commited on
Commit
a20692f
·
verified ·
1 Parent(s): cf44c12

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -218,6 +218,16 @@ def generate_risk_snippet(abuse_score, top_label, escalation_score, stage):
218
 
219
  return base
220
  def analyze_single_message(text, thresholds):
 
 
 
 
 
 
 
 
 
 
221
  motif_hits, matched_phrases = detect_motifs(text)
222
  result = sst_pipeline(text)[0]
223
  sentiment = "supportive" if result['label'] == "POSITIVE" else "undermining"
 
218
 
219
  return base
220
  def analyze_single_message(text, thresholds):
221
+ # NEW: Quick healthy check
222
+ if is_healthy_message(text):
223
+ print("✅ Message detected as healthy. Skipping abuse detection.")
224
+ abuse_score = 0
225
+ threshold_labels = []
226
+ top_patterns = []
227
+ sentiment_result = {"label": "POSITIVE", "score": 1.0}
228
+ stage = 4 # Calm/Honeymoon
229
+ darvo_score = 0.0
230
+ return abuse_score, threshold_labels, top_patterns, sentiment_result, stage, darvo_score
231
  motif_hits, matched_phrases = detect_motifs(text)
232
  result = sst_pipeline(text)[0]
233
  sentiment = "supportive" if result['label'] == "POSITIVE" else "undermining"