bambadij commited on
Commit
2030deb
·
1 Parent(s): 201e86d

Add application file

Browse files
Files changed (2) hide show
  1. Dockerfile +4 -1
  2. app.py +4 -0
Dockerfile CHANGED
@@ -4,10 +4,13 @@ WORKDIR /app
4
 
5
  COPY . /app/
6
  RUN pip install --upgrade pip
 
7
 
8
  RUN pip install --no-cache-dir -r requirements.txt
9
 
10
- RUN pip install fastapi uvicorn
 
 
11
 
12
  EXPOSE 8080
13
  CMD ["uvicorn", "app:app", "--reload", "--host", "0.0.0.0", "--port", "8080"]
 
4
 
5
  COPY . /app/
6
  RUN pip install --upgrade pip
7
+ COPY requirements.txt requirements.txt
8
 
9
  RUN pip install --no-cache-dir -r requirements.txt
10
 
11
+ RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
12
+ ENV TRANSFORMERS_CACHE=/app/.cache
13
+ ENV HF_HOME=/app/.cache
14
 
15
  EXPOSE 8080
16
  CMD ["uvicorn", "app:app", "--reload", "--host", "0.0.0.0", "--port", "8080"]
app.py CHANGED
@@ -7,7 +7,11 @@ import logging
7
  from PIL import Image
8
  import pytesseract
9
  from io import BytesIO
 
10
 
 
 
 
11
  #Additional information
12
 
13
  Informations = """
 
7
  from PIL import Image
8
  import pytesseract
9
  from io import BytesIO
10
+ import os
11
 
12
+ # Configurer les répertoires de cache
13
+ os.environ['TRANSFORMERS_CACHE'] = '/app/.cache'
14
+ os.environ['HF_HOME'] = '/app/.cache'
15
  #Additional information
16
 
17
  Informations = """