lg3394 commited on
Commit
e1732a2
·
verified ·
1 Parent(s): 6d5858a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
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
- except AttributeError as ae:
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()