Spaces:
Sleeping
Sleeping
Update app.py
Browse filestambah spasi antar paragraf di bagian deteksi abusif
app.py
CHANGED
|
@@ -158,7 +158,7 @@ def analyze_text(judul, isi):
|
|
| 158 |
return usia, ", ".join(sorted(detected))
|
| 159 |
|
| 160 |
# ======================
|
| 161 |
-
# FILTER ABUSIVE (TERPISAH +
|
| 162 |
# ======================
|
| 163 |
def filter_abusive(isi):
|
| 164 |
log("\n" + "=" * 80)
|
|
@@ -203,9 +203,14 @@ def filter_abusive(isi):
|
|
| 203 |
log(f"[ABUSIVE] ⚠️ {note}")
|
| 204 |
|
| 205 |
output.append(para)
|
| 206 |
-
output.extend(notes)
|
| 207 |
|
| 208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
log("\n[ABUSIVE] OUTPUT:")
|
| 210 |
log(result)
|
| 211 |
log("=" * 80)
|
|
@@ -226,9 +231,8 @@ def analyze_router(judul, isi, mode):
|
|
| 226 |
}
|
| 227 |
|
| 228 |
if mode == "abusive":
|
| 229 |
-
filtered = filter_abusive(isi)
|
| 230 |
return {
|
| 231 |
-
"filtered_text":
|
| 232 |
}
|
| 233 |
|
| 234 |
return {
|
|
|
|
| 158 |
return usia, ", ".join(sorted(detected))
|
| 159 |
|
| 160 |
# ======================
|
| 161 |
+
# FILTER ABUSIVE (TERPISAH + PARAGRAF RAPI)
|
| 162 |
# ======================
|
| 163 |
def filter_abusive(isi):
|
| 164 |
log("\n" + "=" * 80)
|
|
|
|
| 203 |
log(f"[ABUSIVE] ⚠️ {note}")
|
| 204 |
|
| 205 |
output.append(para)
|
|
|
|
| 206 |
|
| 207 |
+
if notes:
|
| 208 |
+
output.append("")
|
| 209 |
+
output.extend(notes)
|
| 210 |
+
|
| 211 |
+
output.append("")
|
| 212 |
+
|
| 213 |
+
result = "\n".join(output).strip()
|
| 214 |
log("\n[ABUSIVE] OUTPUT:")
|
| 215 |
log(result)
|
| 216 |
log("=" * 80)
|
|
|
|
| 231 |
}
|
| 232 |
|
| 233 |
if mode == "abusive":
|
|
|
|
| 234 |
return {
|
| 235 |
+
"filtered_text": filter_abusive(isi)
|
| 236 |
}
|
| 237 |
|
| 238 |
return {
|