Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
def score_comment(comment):
|
3 |
+
vectorized_comment = vectorizer([comment])
|
4 |
+
results = model.predict(vectorized_comment)
|
5 |
+
|
6 |
+
text = ''
|
7 |
+
for idx, col in enumerate(df.columns[2:]):
|
8 |
+
text += '{}: {}\n'.format(col, results[0][idx]>0.5)
|
9 |
+
|
10 |
+
return text
|
11 |
+
|
12 |
+
interface = gr.Interface(fn = score_comment, inputs=gr.Textbox(lines=2, placeholder='Comment to score'), outputs = 'text', title='Comment Toxicity', description='Check comment, how much is it toxic:')
|
13 |
+
interface.launch(share=True)
|