danieaneta commited on
Commit
202e554
·
1 Parent(s): 13f1e7d

update names and cache handling

Browse files
Files changed (2) hide show
  1. Dockerfile +7 -8
  2. depth_est.py +1 -1
Dockerfile CHANGED
@@ -2,13 +2,10 @@
2
  FROM python:3.9-slim
3
 
4
  # Set the working directory in the container
5
- WORKDIR /app
6
 
7
- # Create a directory for the Hugging Face cache
8
- RUN mkdir -p /app/hf_cache
9
-
10
- # Copy the current directory contents into the container at /app
11
- COPY . /app
12
 
13
  # Install any needed packages specified in requirements.txt
14
  RUN pip install --no-cache-dir -r requirements.txt
@@ -16,9 +13,11 @@ RUN pip install --no-cache-dir -r requirements.txt
16
  # Make port 8000 available to the world outside this container
17
  EXPOSE 8000
18
 
19
- # Set environment variable for the Hugging Face cache
20
- ENV TRANSFORMERS_CACHE=/app/hf_cache
21
  ENV NAME World
22
 
23
  # Run app.py when the container launches
24
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
 
 
 
2
  FROM python:3.9-slim
3
 
4
  # Set the working directory in the container
5
+ WORKDIR /test_docker
6
 
7
+ # Copy the current directory contents into the container at /test_docker
8
+ COPY . /test_docker
 
 
 
9
 
10
  # Install any needed packages specified in requirements.txt
11
  RUN pip install --no-cache-dir -r requirements.txt
 
13
  # Make port 8000 available to the world outside this container
14
  EXPOSE 8000
15
 
16
+ # Set environment variable for the Hugging Face home directory
17
+ ENV HF_HOME=/test_docker/hf_cache
18
  ENV NAME World
19
 
20
  # Run app.py when the container launches
21
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
22
+
23
+
depth_est.py CHANGED
@@ -7,7 +7,7 @@ import numpy as np
7
  import os
8
 
9
 
10
- os.environ['TRANSFORMERS_CACHE'] = '/app/hf_cache'
11
 
12
  def convert_img_base64(img):
13
  with open(img, 'rb') as file:
 
7
  import os
8
 
9
 
10
+ os.environ['HF_HOME'] = '/hf_cache'
11
 
12
  def convert_img_base64(img):
13
  with open(img, 'rb') as file: