Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +10 -0
src/streamlit_app.py
CHANGED
|
@@ -4,6 +4,16 @@ import requests
|
|
| 4 |
import re # To help clean up leading whitespace
|
| 5 |
import sys
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
# Prefer pysqlite3 (if installed) for SQLite; otherwise fall back to stdlib sqlite3.
|
| 8 |
# This mirrors the previous behavior but is robust when pysqlite3 isn't available.
|
| 9 |
try:
|
|
|
|
| 4 |
import re # To help clean up leading whitespace
|
| 5 |
import sys
|
| 6 |
|
| 7 |
+
# ✅ Redirect Hugging Face and Streamlit caches to writable folders
|
| 8 |
+
os.environ["HF_HOME"] = "/tmp/huggingface"
|
| 9 |
+
os.environ["TRANSFORMERS_CACHE"] = "/tmp/huggingface"
|
| 10 |
+
os.environ["SENTENCE_TRANSFORMERS_HOME"] = "/tmp/huggingface"
|
| 11 |
+
os.environ["STREAMLIT_CACHE_DIR"] = "/tmp/streamlit"
|
| 12 |
+
os.environ["XDG_CACHE_HOME"] = "/tmp"
|
| 13 |
+
|
| 14 |
+
# ✅ (Optional) If using LangChain
|
| 15 |
+
os.environ["LANGCHAIN_CACHE"] = "/tmp/langchain"
|
| 16 |
+
|
| 17 |
# Prefer pysqlite3 (if installed) for SQLite; otherwise fall back to stdlib sqlite3.
|
| 18 |
# This mirrors the previous behavior but is robust when pysqlite3 isn't available.
|
| 19 |
try:
|