Spaces:
Runtime error
Runtime error
File size: 603 Bytes
884fcba 4734e0d 03d6caa 4734e0d 3107ec5 4734e0d ed13968 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
!pip install gradio tensorflow
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() |