Spaces:
Sleeping
Sleeping
Timo
commited on
Commit
·
55fea2c
1
Parent(s):
f83d2ce
OK
Browse files- src/streamlit_app.py +11 -1
src/streamlit_app.py
CHANGED
|
@@ -24,7 +24,17 @@ import streamlit as st
|
|
| 24 |
from draft_model import DraftModel
|
| 25 |
|
| 26 |
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
|
| 30 |
SUPPORTED_SETS_PATH = Path("supported_sets.txt")
|
|
|
|
| 24 |
from draft_model import DraftModel
|
| 25 |
|
| 26 |
|
| 27 |
+
# 1) choose writable locations ( /tmp is always safe in Spaces )
|
| 28 |
+
os.environ.setdefault("HOME", "/tmp") # fixes expanduser
|
| 29 |
+
os.environ.setdefault("STREAMLIT_HOME", "/tmp/.streamlit") # telemetry etc.
|
| 30 |
+
os.environ.setdefault("HF_HOME", "/tmp/hf_cache") # model files
|
| 31 |
+
|
| 32 |
+
# 2) create them so the next write succeeds
|
| 33 |
+
for _dir in (os.environ["STREAMLIT_HOME"], os.environ["HF_HOME"]):
|
| 34 |
+
pathlib.Path(_dir).mkdir(parents=True, exist_ok=True)
|
| 35 |
+
|
| 36 |
+
# 3) silence the “Collecting usage statistics…” banner completely
|
| 37 |
+
os.environ["STREAMLIT_BROWSER_GATHERUSAGESTATS"] = "false"
|
| 38 |
|
| 39 |
|
| 40 |
SUPPORTED_SETS_PATH = Path("supported_sets.txt")
|