Update app.py
Browse files
app.py
CHANGED
@@ -44,11 +44,10 @@ def predict(text):
|
|
44 |
X = preprocess(text, tokenizer)
|
45 |
pred = model.predict(X)
|
46 |
probabilities = np.mean(pred, axis=0)
|
47 |
-
|
48 |
-
if final_class == 0:
|
49 |
-
prediction = "The string is classified as hate speech."
|
50 |
-
else:
|
51 |
prediction = "The string is classified as normal speech."
|
|
|
|
|
52 |
return prediction, probabilities.tolist()
|
53 |
|
54 |
iface = gr.Interface(
|
|
|
44 |
X = preprocess(text, tokenizer)
|
45 |
pred = model.predict(X)
|
46 |
probabilities = np.mean(pred, axis=0)
|
47 |
+
if probabilities.tolist()[0] > 0.72:
|
|
|
|
|
|
|
48 |
prediction = "The string is classified as normal speech."
|
49 |
+
else:
|
50 |
+
prediction = "The string is classified as hate speech."
|
51 |
return prediction, probabilities.tolist()
|
52 |
|
53 |
iface = gr.Interface(
|