Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -15,6 +15,9 @@ model_path = "my_model.h5" # Set your model path here
|
|
15 |
def load_lstm_model(model_path):
|
16 |
return load_model(model_path)
|
17 |
|
|
|
|
|
|
|
18 |
def clean_text(text):
|
19 |
# Remove stopwords
|
20 |
stop_words = set(stopwords.words('english'))
|
@@ -73,8 +76,6 @@ def main():
|
|
73 |
|
74 |
if st.button("Detect Hate Speech"):
|
75 |
if input_text:
|
76 |
-
# Load the model
|
77 |
-
lstm_model = load_lstm_model(model_path)
|
78 |
# Predict hate speech
|
79 |
prediction = predict_hate_speech(input_text, lstm_model)
|
80 |
if prediction > 0.5:
|
|
|
15 |
def load_lstm_model(model_path):
|
16 |
return load_model(model_path)
|
17 |
|
18 |
+
# Load the model
|
19 |
+
lstm_model = load_lstm_model(model_path)
|
20 |
+
|
21 |
def clean_text(text):
|
22 |
# Remove stopwords
|
23 |
stop_words = set(stopwords.words('english'))
|
|
|
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:
|