Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,16 +4,16 @@ import nltk
|
|
4 |
from nltk.corpus import stopwords
|
5 |
from nltk.tokenize import word_tokenize
|
6 |
|
|
|
|
|
|
|
|
|
7 |
# Load the trained KNN model
|
8 |
knn_classifier = joblib.load('knn_model.pkl')
|
9 |
|
10 |
# Load the TF-IDF vectorizer
|
11 |
tfidf_vectorizer = joblib.load('tfidf_vectorizer.pkl')
|
12 |
|
13 |
-
# Download nltk resources
|
14 |
-
nltk.download('punkt')
|
15 |
-
nltk.download('stopwords')
|
16 |
-
|
17 |
# Text Preprocessing Function
|
18 |
stop_words = set(stopwords.words('english'))
|
19 |
|
|
|
4 |
from nltk.corpus import stopwords
|
5 |
from nltk.tokenize import word_tokenize
|
6 |
|
7 |
+
# Ensure NLTK resources are downloaded
|
8 |
+
nltk.download('punkt')
|
9 |
+
nltk.download('stopwords')
|
10 |
+
|
11 |
# Load the trained KNN model
|
12 |
knn_classifier = joblib.load('knn_model.pkl')
|
13 |
|
14 |
# Load the TF-IDF vectorizer
|
15 |
tfidf_vectorizer = joblib.load('tfidf_vectorizer.pkl')
|
16 |
|
|
|
|
|
|
|
|
|
17 |
# Text Preprocessing Function
|
18 |
stop_words = set(stopwords.words('english'))
|
19 |
|