Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
import tensorflow as tf
|
| 2 |
-
import gradio as gr
|
| 3 |
-
|
| 4 |
-
model = tf.keras.models.load_model('hate_speech.h5')
|
| 5 |
-
|
| 6 |
-
def score_comment(comment):
|
| 7 |
-
vectorized_comment = vectorizer([comment])
|
| 8 |
-
results = model.predict(vectorized_comment)
|
| 9 |
-
|
| 10 |
-
for idx, col in enumerate(df.columns[2:]):
|
| 11 |
-
if results[0][idx]>0.5:
|
| 12 |
-
return 'Hate Speech detected'
|
| 13 |
-
|
| 14 |
-
return 'No hate speech detected'
|
| 15 |
-
|
| 16 |
-
interface = gr.Interface(fn=score_comment,
|
| 17 |
-
inputs=gr.Textbox(lines=2, placeholder='Comment to score'),
|
| 18 |
-
outputs='text')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|