Maitreyee22 commited on
Commit
59e0873
·
verified ·
1 Parent(s): 3fc0a28

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +11 -0
src/streamlit_app.py CHANGED
@@ -1,3 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
  # Import the high-level pipeline API from Hugging Face Transformers
3
  # It simplifies loading models/tokenizers and running common tasks
 
1
+ import os
2
+
3
+ # 1. Create the folder if it doesn't exist
4
+ cache_root = "/mnt/data/huggingface"
5
+ os.makedirs(cache_root, exist_ok=True)
6
+
7
+ # 2. Redirect Hugging Face Hub, Transformers & Datasets caches
8
+ os.environ["HF_HOME"] = cache_root
9
+ os.environ["TRANSFORMERS_CACHE"] = os.path.join(cache_root, "transformers")
10
+ os.environ["HF_DATASETS_CACHE"] = os.path.join(cache_root, "datasets")
11
+
12
  import streamlit as st
13
  # Import the high-level pipeline API from Hugging Face Transformers
14
  # It simplifies loading models/tokenizers and running common tasks