Tirath5504 commited on
Commit
b3723d2
·
verified ·
1 Parent(s): f28b5ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
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
- final_class = np.argmax(probabilities)
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(