Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,13 +10,12 @@ import subprocess
|
|
| 10 |
|
| 11 |
|
| 12 |
# Load the LSTM model
|
| 13 |
-
model_path = "my_model.h5" # Set your model path here
|
| 14 |
|
| 15 |
def load_lstm_model(model_path):
|
| 16 |
return load_model(model_path)
|
| 17 |
|
| 18 |
-
|
| 19 |
-
lstm_model = load_lstm_model(model_path)
|
| 20 |
|
| 21 |
def clean_text(text):
|
| 22 |
# Remove stopwords
|
|
@@ -76,6 +75,8 @@ def main():
|
|
| 76 |
|
| 77 |
if st.button("Detect Hate Speech"):
|
| 78 |
if input_text:
|
|
|
|
|
|
|
| 79 |
# Predict hate speech
|
| 80 |
prediction = predict_hate_speech(input_text, lstm_model)
|
| 81 |
if prediction > 0.5:
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
# Load the LSTM model
|
| 13 |
+
model_path = "./my_model.h5" # Set your model path here
|
| 14 |
|
| 15 |
def load_lstm_model(model_path):
|
| 16 |
return load_model(model_path)
|
| 17 |
|
| 18 |
+
|
|
|
|
| 19 |
|
| 20 |
def clean_text(text):
|
| 21 |
# Remove stopwords
|
|
|
|
| 75 |
|
| 76 |
if st.button("Detect Hate Speech"):
|
| 77 |
if input_text:
|
| 78 |
+
# Load the model
|
| 79 |
+
lstm_model = load_lstm_model(model_path)
|
| 80 |
# Predict hate speech
|
| 81 |
prediction = predict_hate_speech(input_text, lstm_model)
|
| 82 |
if prediction > 0.5:
|