Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,10 +9,20 @@ from transformers import pipeline, BertForSequenceClassification, BertTokenizer
|
|
| 9 |
from nltk.sentiment.vader import SentimentIntensityAnalyzer
|
| 10 |
|
| 11 |
# ---------------- INIT ----------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
try:
|
| 13 |
nltk.data.find("sentiment/vader_lexicon")
|
| 14 |
except LookupError:
|
| 15 |
-
nltk.download("vader_lexicon")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
vader = SentimentIntensityAnalyzer()
|
| 17 |
|
| 18 |
# Emotion model
|
|
|
|
| 9 |
from nltk.sentiment.vader import SentimentIntensityAnalyzer
|
| 10 |
|
| 11 |
# ---------------- INIT ----------------
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
NLTK_DATA_PATH = os.path.join(os.path.dirname(__file__), "nltk_data")
|
| 15 |
+
os.makedirs(NLTK_DATA_PATH, exist_ok=True)
|
| 16 |
+
|
| 17 |
+
# Ensure VADER is available
|
| 18 |
try:
|
| 19 |
nltk.data.find("sentiment/vader_lexicon")
|
| 20 |
except LookupError:
|
| 21 |
+
nltk.download("vader_lexicon", download_dir=NLTK_DATA_PATH)
|
| 22 |
+
|
| 23 |
+
# Add path manually so nltk can find it
|
| 24 |
+
nltk.data.path.append(NLTK_DATA_PATH)
|
| 25 |
+
|
| 26 |
vader = SentimentIntensityAnalyzer()
|
| 27 |
|
| 28 |
# Emotion model
|