Spaces:
Runtime error
Runtime error
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) |