Rachel1809's picture
Update app.py
9467a0c
raw history blame
No virus
571 Bytes
import gradio as gr
import tensorflow as tf
model = tf.keras.models.load_model('toxic-detect.h5')
def evaluate_comment(Comment):
processed_Comment = vectorizer([Comment])
res = model.predict(processed_Comment)
text = ''
for i, col in enumerate(df.columns[2:]):
text += '{}: {}\n'.format(col, 'Violate' if res[0][i] > 0.5 else 'None')
return text
interface = gr.Interface(fn = evaluate_comment, inputs = gr.inputs.Textbox(lines = 4, placeholder='Comment to evaluate'), outputs = 'text')
interface.launch()