kkAsmaa commited on
Commit
b86bcb5
ยท
verified ยท
1 Parent(s): a63d299

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -101,6 +101,10 @@ def predict_safety_api(text):
101
  triggered_windows.append(idx + 1)
102
 
103
  final_prediction = "UNSAFE" if is_blocked else "SAFE"
 
 
 
 
104
 
105
  print("\n๐Ÿ“Š ===== CHILDSHIELD REPORT =====")
106
  print(f"๐Ÿ“ฅ Original Text:\n{text[:100]}")
@@ -109,6 +113,7 @@ def predict_safety_api(text):
109
  print(f"๐ŸชŸ Total Windows: {total_windows_count}")
110
  print(f"๐Ÿšจ Final Verdict: {final_prediction}")
111
  print(f"๐Ÿ›‘ Triggered Windows ID: {triggered_windows}")
 
112
  print("=================================\n")
113
 
114
  try:
 
101
  triggered_windows.append(idx + 1)
102
 
103
  final_prediction = "UNSAFE" if is_blocked else "SAFE"
104
+
105
+ unsafe_confidence_score = round(highest_unsafe_prob, 4)
106
+ safe_confidence_score = round(1.0 - highest_unsafe_prob, 4)
107
+ final_confidence = unsafe_confidence_score if is_blocked else safe_confidence_score
108
 
109
  print("\n๐Ÿ“Š ===== CHILDSHIELD REPORT =====")
110
  print(f"๐Ÿ“ฅ Original Text:\n{text[:100]}")
 
113
  print(f"๐ŸชŸ Total Windows: {total_windows_count}")
114
  print(f"๐Ÿšจ Final Verdict: {final_prediction}")
115
  print(f"๐Ÿ›‘ Triggered Windows ID: {triggered_windows}")
116
+ print(f"๐Ÿ† Confidence Score: {final_confidence * 100:.2f}%") # ๐ŸŽฏ ุงู„ุณุทุฑ ุงู„ุณุญุฑูŠ ุงู„ุฌุฏูŠุฏ
117
  print("=================================\n")
118
 
119
  try: