Spaces:
Runtime error
Runtime error
import os | |
os.system('pip install -e ./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() |