Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -23,5 +23,14 @@ def moderate_text(text):
|
|
23 |
return f"The text is flagged for moderation due to: {', '.join(flagged_categories)}"
|
24 |
else:
|
25 |
return "The text is not flagged for any moderation issues."
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
return f"The text is flagged for moderation due to: {', '.join(flagged_categories)}"
|
24 |
else:
|
25 |
return "The text is not flagged for any moderation issues."
|
26 |
+
except AttributeError as ae: # Ensure the exception block is aligned with the try block
|
27 |
+
return f"An error occurred: {ae}"
|
28 |
+
|
29 |
+
iface = gr.Interface(
|
30 |
+
fn=moderate_text,
|
31 |
+
inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
|
32 |
+
outputs="text",
|
33 |
+
title="Text Moderation Tool"
|
34 |
+
)
|
35 |
+
|
36 |
+
iface.launch()
|