Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -183,20 +183,10 @@ st.markdown(
|
|
| 183 |
|
| 184 |
st.markdown("<div class='prompt-box'>Paste the article content below to analyze its category with PressGuard🛡️</div>", unsafe_allow_html=True)
|
| 185 |
|
| 186 |
-
#
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
# Download NLTK resources only if not already present
|
| 192 |
-
for resource in ['punkt_tab', 'stopwords', 'wordnet']:
|
| 193 |
-
try:
|
| 194 |
-
nltk.data.find(f'tokenizers/{resource}' if resource == 'punkt_tab' else f'corpora/{resource}')
|
| 195 |
-
except LookupError:
|
| 196 |
-
nltk.download(resource, download_dir=nltk_data_path)
|
| 197 |
-
|
| 198 |
-
# Set NLTK data path
|
| 199 |
-
nltk.data.path.append(nltk_data_path)
|
| 200 |
|
| 201 |
# Initialize stopwords and lemmatizer
|
| 202 |
stop_words = set(stopwords.words('english')).union({"pm"})
|
|
|
|
| 183 |
|
| 184 |
st.markdown("<div class='prompt-box'>Paste the article content below to analyze its category with PressGuard🛡️</div>", unsafe_allow_html=True)
|
| 185 |
|
| 186 |
+
# Download necessary resources
|
| 187 |
+
nltk.download('punkt_tab')
|
| 188 |
+
nltk.download('stopwords')
|
| 189 |
+
nltk.download('wordnet')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
|
| 191 |
# Initialize stopwords and lemmatizer
|
| 192 |
stop_words = set(stopwords.words('english')).union({"pm"})
|