VietCat commited on
Commit
daa84b4
·
1 Parent(s): 6e82314

fix runtime error

Browse files
Files changed (2) hide show
  1. Dockerfile +5 -7
  2. app.py +1 -1
Dockerfile CHANGED
@@ -1,10 +1,5 @@
1
  FROM python:3.10-slim
2
 
3
- # Set env vars to avoid permission issues and suppress deprecation warnings
4
- ENV TRANSFORMERS_CACHE=/app/cache \
5
- HF_HOME=/app/cache \
6
- PYTHONUNBUFFERED=1
7
-
8
  WORKDIR /app
9
 
10
  # Install dependencies
@@ -13,9 +8,12 @@ RUN pip install --no-cache-dir -r requirements.txt
13
 
14
  # Copy source code
15
  COPY app.py .
16
- RUN mkdir -p /app/cache /app/flagged
17
- RUN mkdir -p /tmp/hf_cache /tmp/hf_home
18
 
 
 
 
 
 
19
 
20
  EXPOSE 7860
21
 
 
1
  FROM python:3.10-slim
2
 
 
 
 
 
 
3
  WORKDIR /app
4
 
5
  # Install dependencies
 
8
 
9
  # Copy source code
10
  COPY app.py .
 
 
11
 
12
+ RUN mkdir -p /app/cache
13
+
14
+ # Set env vars to avoid permission issues and suppress deprecation warnings
15
+ ENV HF_HOME=/app/cache \
16
+ PYTHONUNBUFFERED=1
17
 
18
  EXPOSE 7860
19
 
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import os
2
- os.environ["TRANSFORMERS_CACHE"] = "/tmp/hf_cache"
3
  os.environ["HF_HOME"] = "/tmp/hf_home"
4
 
5
  from transformers import GPT2LMHeadModel, GPT2Tokenizer
 
1
  import os
2
+ # Thiết lập biến môi trường HF_HOME
3
  os.environ["HF_HOME"] = "/tmp/hf_home"
4
 
5
  from transformers import GPT2LMHeadModel, GPT2Tokenizer