Spaces:
Runtime error
Runtime error
File size: 611 Bytes
4734e0d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import gradio as gr
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(share=True) |