tlong-ds commited on
Commit
df98cec
·
1 Parent(s): 2c92ec9
Files changed (2) hide show
  1. Dockerfile +1 -1
  2. model.py +2 -2
Dockerfile CHANGED
@@ -12,7 +12,7 @@ ENV NLTK_DATA=/app/nltk_data
12
 
13
  # Create NLTK data directory and download required data
14
  RUN mkdir -p /app/nltk_data && \
15
- python -c "import nltk; nltk.download('twitter_samples', download_dir='/app/nltk_data'); nltk.download('stopwords', download_dir='/app/nltk_data')"
16
 
17
  # Copy source code
18
  COPY . /app
 
12
 
13
  # Create NLTK data directory and download required data
14
  RUN mkdir -p /app/nltk_data && \
15
+ python -c "import nltk; nltk.data.path.append('/app/nltk_data'); nltk.download('twitter_samples', download_dir='/app/nltk_data'); nltk.download('stopwords', download_dir='/app/nltk_data')"
16
 
17
  # Copy source code
18
  COPY . /app
model.py CHANGED
@@ -9,8 +9,8 @@ from nltk.tokenize import TweetTokenizer
9
  from nltk.corpus import stopwords, twitter_samples
10
  from sklearn.linear_model import LogisticRegression
11
 
12
- nltk.download('twitter_samples')
13
- nltk.download('stopwords')
14
  all_positive_tweets = twitter_samples.strings('positive_tweets.json')
15
  all_negative_tweets = twitter_samples.strings('negative_tweets.json')
16
 
 
9
  from nltk.corpus import stopwords, twitter_samples
10
  from sklearn.linear_model import LogisticRegression
11
 
12
+ # NLTK data is pre-downloaded during Docker build
13
+ # No need to download at runtime
14
  all_positive_tweets = twitter_samples.strings('positive_tweets.json')
15
  all_negative_tweets = twitter_samples.strings('negative_tweets.json')
16