Timo commited on
Commit
8b2e8bb
·
1 Parent(s): a8ab236

Fixed env variables

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +7 -3
src/streamlit_app.py CHANGED
@@ -15,9 +15,13 @@ for Hugging Face Spaces deployment.
15
  from __future__ import annotations
16
  import os, pathlib
17
  # Writable locations --------------------------------------------------
18
- os.environ.setdefault("HOME", "/tmp") # fixes expanduser("~")
19
- os.environ.setdefault("STREAMLIT_HOME", "/tmp/.st_home") # Streamlit telemetry
20
- os.environ.setdefault("HF_HOME", "/tmp/hf_cache") # Hub model cache
 
 
 
 
21
  # --------------------------------------------------------------------
22
 
23
  # create the dirs once
 
15
  from __future__ import annotations
16
  import os, pathlib
17
  # Writable locations --------------------------------------------------
18
+ os.environ["HOME"] = "/tmp" # force, not setdefault
19
+ os.environ["XDG_CONFIG_HOME"] = "/tmp"
20
+ os.environ["STREAMLIT_CONFIG_DIR"] = "/tmp/.streamlit"
21
+ os.environ["STREAMLIT_CACHE_DIR"] = "/tmp/.st-cache"
22
+ os.environ["STREAMLIT_BROWSER_GATHERUSAGESTATS"] = "false"
23
+ for d in ("/tmp/.streamlit", "/tmp/.st-cache"):
24
+ pathlib.Path(d).mkdir(parents=True, exist_ok=True)
25
  # --------------------------------------------------------------------
26
 
27
  # create the dirs once