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

update with hf cache

Browse files
Files changed (2) hide show
  1. Dockerfile +5 -1
  2. depth_est.py +4 -0
Dockerfile CHANGED
@@ -4,6 +4,9 @@ FROM python:3.9-slim
4
  # Set the working directory in the container
5
  WORKDIR /app
6
 
 
 
 
7
  # Copy the current directory contents into the container at /app
8
  COPY . /app
9
 
@@ -13,7 +16,8 @@ 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
- # Define environment variable
 
17
  ENV NAME World
18
 
19
  # Run app.py when the container launches
 
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
 
 
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
depth_est.py CHANGED
@@ -4,6 +4,10 @@ import base64
4
  import requests
5
  import io
6
  import numpy as np
 
 
 
 
7
 
8
  def convert_img_base64(img):
9
  with open(img, 'rb') as file:
 
4
  import requests
5
  import io
6
  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: