Spaces:
Running
Running
Update app.py
Browse files
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:
|