Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import Negativ.PythonCode.__init__ as pc
|
3 |
+
|
4 |
+
msg_deleted = "--This Toxic Comment Has Been Deleted--"
|
5 |
+
|
6 |
+
print(dir(pc))
|
7 |
+
|
8 |
+
def predict_toxicity(sentence):
|
9 |
+
|
10 |
+
if pc.is_toxic(sentence):
|
11 |
+
return msg_deleted
|
12 |
+
|
13 |
+
else:
|
14 |
+
return sentence
|
15 |
+
|
16 |
+
demo = gr.Interface(fn=predict_toxicity, inputs="text", outputs="text")
|
17 |
+
demo.launch()
|