tranduy2611 commited on
Commit
ad21ed7
·
1 Parent(s): 6e70cf2
Files changed (2) hide show
  1. Dockerfile +3 -3
  2. app.py +4 -0
Dockerfile CHANGED
@@ -6,11 +6,11 @@ COPY . .
6
 
7
  # Set the working directory to /
8
  WORKDIR /
9
- ENV HF_HOME=/.cache/huggingface/hub
10
- ENV TRANSFORMERS_CACHE=/.cache/huggingface/hub
11
  # Set environment variables
12
  ENV HUGGINGFACE_TOKEN=""
13
- RUN mkdir -p /.cache/huggingface/hub
 
14
 
15
  # Install requirements.txt
16
  RUN pip install --no-cache-dir --upgrade -r /requirements.txt
 
6
 
7
  # Set the working directory to /
8
  WORKDIR /
9
+ ENV HF_HOME=/app/huggingface_cache
 
10
  # Set environment variables
11
  ENV HUGGINGFACE_TOKEN=""
12
+ RUN mkdir -p /app/huggingface_cache && chmod -R 777 /app/huggingface_cache
13
+
14
 
15
  # Install requirements.txt
16
  RUN pip install --no-cache-dir --upgrade -r /requirements.txt
app.py CHANGED
@@ -6,6 +6,10 @@ from huggingface_hub import login
6
  import torch
7
  import os
8
 
 
 
 
 
9
  # Initialize FastAPI app
10
  app = FastAPI()
11
  hf_token = os.environ.get("HUGGINGFACE_TOKEN")
 
6
  import torch
7
  import os
8
 
9
+
10
+ os.environ["HF_HOME"] = "/app/huggingface_cache"
11
+ # Ensure the cache directory exists
12
+ os.makedirs("/app/huggingface_cache", exist_ok=True)
13
  # Initialize FastAPI app
14
  app = FastAPI()
15
  hf_token = os.environ.get("HUGGINGFACE_TOKEN")