Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- 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
|