Ouiam123 commited on
Commit
c5c17d1
·
verified ·
1 Parent(s): b619002

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -8,9 +8,12 @@ from dotenv import load_dotenv
8
  # Load environment variables
9
  load_dotenv()
10
 
11
- # Create a temporary cache directory
12
- writable_cache_dir = tempfile.mkdtemp()
13
- os.environ["TRANSFORMERS_CACHE"] = writable_cache_dir
 
 
 
14
 
15
  # Retrieve the Hugging Face API token from environment variables
16
  api_token = os.getenv("ttt")
 
8
  # Load environment variables
9
  load_dotenv()
10
 
11
+ # Set the cache directory to the one specified in the environment variable
12
+ cache_dir = os.getenv("TRANSFORMERS_CACHE", "/.cache/huggingface/hub")
13
+
14
+ # Ensure the cache directory is writable
15
+ os.makedirs(cache_dir, exist_ok=True)
16
+ os.environ["TRANSFORMERS_CACHE"] = cache_dir
17
 
18
  # Retrieve the Hugging Face API token from environment variables
19
  api_token = os.getenv("ttt")