alohaboy commited on
Commit
6e6e1e7
·
1 Parent(s): 9d80233

Fix normal bypass: standardize detection result format

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -266,11 +266,15 @@ class HateSpeechDetectorService:
266
  # If hate_tokens contain B-HARD, I-HARD, increase label to L2_hate
267
  if any(bio_label in ["B-HARD", "I-HARD"] for _, _, bio_label in hate_tokens):
268
  label = "L2_hate"
269
- # Construct result message
270
- result_msg = f"Detection result: {label}\nConfidence: {sentence_prob:.2f}"
 
 
 
271
  if hate_tokens:
272
- result_msg += f"\nIdentified hate/aggressive expressions: {hate_tokens}"
273
- mitigation = "Performed only detection."
 
274
  debug_info = {
275
  'sentence_logits': sentence_logits,
276
  'sentence_probs': sentence_probs,
 
266
  # If hate_tokens contain B-HARD, I-HARD, increase label to L2_hate
267
  if any(bio_label in ["B-HARD", "I-HARD"] for _, _, bio_label in hate_tokens):
268
  label = "L2_hate"
269
+
270
+ # Construct result message with consistent format
271
+ result_msg = f"🔍 **Detection Result**\n\n"
272
+ result_msg += f"**Classification:** {label}\n"
273
+ result_msg += f"**Confidence:** {sentence_prob:.2f}\n"
274
  if hate_tokens:
275
+ result_msg += f"**Identified Expressions:** {hate_tokens}"
276
+
277
+ mitigation = "**Detection Only:** Performed only detection."
278
  debug_info = {
279
  'sentence_logits': sentence_logits,
280
  'sentence_probs': sentence_probs,