Rachel1809 commited on
Commit
4734e0d
1 Parent(s): fb0e182

Create new file

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ model = tf.keras.models.load_model('toxic-detect.h5')
4
+
5
+ def evaluate_comment(Comment):
6
+ processed_Comment = vectorizer([Comment])
7
+ res = model.predict(processed_Comment)
8
+
9
+ text = ''
10
+ for i, col in enumerate(df.columns[2:]):
11
+ text += '{}: {}\n'.format(col, 'Violate' if res[0][i] > 0.5 else 'None')
12
+
13
+ return text
14
+
15
+ interface = gr.Interface(fn = evaluate_comment,
16
+ inputs = gr.inputs.Textbox(lines = 4, placeholder='Comment to evaluate'),
17
+ outputs = 'text')
18
+
19
+ interface.launch(share=True)