TLeonidas commited on
Commit
e326036
·
verified ·
1 Parent(s): 5d56b39

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -4,7 +4,7 @@ import joblib
4
  # Function to load your model (adjust the path and method if needed)
5
  def load_model():
6
  # This path is relative to the root of your Hugging Face Space
7
- model_path = "./en-hate-speech-detection-3label"
8
  model = joblib.load(model_path)
9
  return model
10
 
@@ -20,7 +20,7 @@ def predict_hate_speech(text):
20
  # Adjusted Gradio interface to take text input and output model predictions
21
  iface = gr.Interface(fn=predict_hate_speech,
22
  inputs=gr.Textbox(lines=2, placeholder="Enter Text Here..."),
23
- outputs="text",
24
  description="Detects hate speech in text. Outputs 'Neutral or Ambiguous', 'Not Hate', 'Offensive or Hate Speech'.")
25
  iface.launch()
26
 
 
4
  # Function to load your model (adjust the path and method if needed)
5
  def load_model():
6
  # This path is relative to the root of your Hugging Face Space
7
+ model_path = "./random_forest_model_3labels2.joblib"
8
  model = joblib.load(model_path)
9
  return model
10
 
 
20
  # Adjusted Gradio interface to take text input and output model predictions
21
  iface = gr.Interface(fn=predict_hate_speech,
22
  inputs=gr.Textbox(lines=2, placeholder="Enter Text Here..."),
23
+ outputs=labels[prediction[0]],
24
  description="Detects hate speech in text. Outputs 'Neutral or Ambiguous', 'Not Hate', 'Offensive or Hate Speech'.")
25
  iface.launch()
26