Abineshkumar77 commited on
Commit
4d9a3fc
·
1 Parent(s): c9fb455

Add application file

Browse files
Files changed (2) hide show
  1. Dockerfile +2 -2
  2. app.py +4 -4
Dockerfile CHANGED
@@ -14,10 +14,10 @@ RUN pip install --no-cache-dir -r requirements.txt
14
  EXPOSE 80
15
 
16
  # Define environment variable
17
- ENV TRANSFORMERS_CACHE=/app/.cache
18
 
19
  # Create cache directory
20
- RUN mkdir -p /app/.cache
21
 
22
  # Run app.py when the container launches
23
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "80"]
 
14
  EXPOSE 80
15
 
16
  # Define environment variable
17
+ ENV HF_HOME=/app/.hf_cache
18
 
19
  # Create cache directory
20
+ RUN mkdir -p /app/.hf_cache
21
 
22
  # Run app.py when the container launches
23
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "80"]
app.py CHANGED
@@ -4,10 +4,10 @@ from transformers import AutoTokenizer, AutoModelForSequenceClassification
4
  from scipy.special import softmax
5
  from typing import Dict
6
 
7
- # Set the TRANSFORMERS_CACHE environment variable to a writable directory
8
- cache_dir = "./.cache"
9
- os.makedirs(cache_dir, exist_ok=True)
10
- os.environ["TRANSFORMERS_CACHE"] = cache_dir
11
 
12
  app = FastAPI()
13
 
 
4
  from scipy.special import softmax
5
  from typing import Dict
6
 
7
+ # Set the HF_HOME environment variable to a writable directory
8
+ hf_home_dir = "./.hf_cache"
9
+ os.makedirs(hf_home_dir, exist_ok=True)
10
+ os.environ["HF_HOME"] = hf_home_dir
11
 
12
  app = FastAPI()
13