Spaces:
Sleeping

doluong6 commited on
Commit
304944c
·
verified ·
1 Parent(s): 559f158

Update routes/tai_pdf.py

Browse files
Files changed (1) hide show
  1. routes/tai_pdf.py +4 -3
routes/tai_pdf.py CHANGED
@@ -4,12 +4,13 @@ from huggingface_hub import hf_hub_download, list_repo_files
4
  from unidecode import unidecode
5
  import os, traceback
6
 
7
- # ✅ Tạo thư mục cache an toàn trong môi trường Hugging Face Space
8
  os.environ["HF_HUB_CACHE"] = "/tmp/hf_cache"
9
- os.environ["TRANSFORMERS_CACHE"] = "/tmp/transformers_cache" # 👈 thêm dòng này
 
10
  os.makedirs("/tmp/hf_cache", exist_ok=True)
11
  os.makedirs("/tmp/transformers_cache", exist_ok=True)
12
-
13
 
14
  router = APIRouter()
15
 
 
4
  from unidecode import unidecode
5
  import os, traceback
6
 
7
+ # ✅ Tạo thư mục cache tạm có quyền ghi
8
  os.environ["HF_HUB_CACHE"] = "/tmp/hf_cache"
9
+ os.environ["TRANSFORMERS_CACHE"] = "/tmp/transformers_cache"
10
+ os.environ["HF_HOME"] = "/tmp/huggingface" # 👈 thêm dòng này nữa
11
  os.makedirs("/tmp/hf_cache", exist_ok=True)
12
  os.makedirs("/tmp/transformers_cache", exist_ok=True)
13
+ os.makedirs("/tmp/huggingface", exist_ok=True) # 👈 tạo thư mục này để loại bỏ lỗi '/.cache'
14
 
15
  router = APIRouter()
16