gavinzli commited on
Commit
3d29524
·
1 Parent(s): 57aa417

Add NLTK data directory creation and download in Dockerfile; log credentials in Gmail service

Browse files
Files changed (2) hide show
  1. Dockerfile +2 -0
  2. app/models/mails/__init__.py +1 -0
Dockerfile CHANGED
@@ -9,9 +9,11 @@ WORKDIR /app
9
 
10
  # Create a cache directory and set permissions
11
  RUN mkdir -p /app/cache && chmod -R 777 /app/cache
 
12
 
13
  # Install requirements.txt
14
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
 
15
 
16
  EXPOSE 7860
17
 
 
9
 
10
  # Create a cache directory and set permissions
11
  RUN mkdir -p /app/cache && chmod -R 777 /app/cache
12
+ RUN mkdir -p /app/nltk_data && chmod -R 777 /app/nltk_data
13
 
14
  # Install requirements.txt
15
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
16
+ # RUN python -c "import nltk; nltk.download('averaged_perceptron_tagger_eng', download_dir='/app/nltk_data'); nltk.download('punkt_tab', download_dir='/app/nltk_data')"
17
 
18
  EXPOSE 7860
19
 
app/models/mails/__init__.py CHANGED
@@ -30,6 +30,7 @@ def build_gmail_service():
30
  if os.path.exists("token.pickle"):
31
  with open("token.pickle", "rb") as token:
32
  creds = pickle.load(token)
 
33
  if not creds or not creds.valid:
34
  if creds and creds.expired and creds.refresh_token:
35
  creds.refresh(Request())
 
30
  if os.path.exists("token.pickle"):
31
  with open("token.pickle", "rb") as token:
32
  creds = pickle.load(token)
33
+ print(creds.to_json())
34
  if not creds or not creds.valid:
35
  if creds and creds.expired and creds.refresh_token:
36
  creds.refresh(Request())