import tensorflow as tf import gradio as gr model = tf.keras.models.load_model('hate_speech.h5') def score_comment(comment): vectorized_comment = vectorizer([comment]) results = model.predict(vectorized_comment) for idx, col in enumerate(df.columns[2:]): if results[0][idx]>0.5: return 'Hate Speech detected' return 'No hate speech detected' interface = gr.Interface(fn=score_comment, inputs=gr.Textbox(lines=2, placeholder='Comment to score'), outputs='text')