Waqas167 commited on
Commit
c4aa709
·
verified ·
1 Parent(s): 69f6b1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -2
app.py CHANGED
@@ -1,5 +1,18 @@
1
- import os
2
- os.environ["STREAMLIT_CONFIG_DIR"] = os.path.join(os.path.dirname(__file__), ".streamlit")
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
 
5
  import io, os, numpy as np, streamlit as st, librosa, torch, soundfile as sf
 
1
+ # ---- force a writable HOME + config dir (must be before importing streamlit) ----
2
+ import os, pathlib
3
+ HOME_DIR = "/home/user" # writable on Hugging Face Spaces
4
+ os.environ["HOME"] = HOME_DIR
5
+ os.environ["XDG_CONFIG_HOME"] = HOME_DIR
6
+
7
+ CONFIG_DIR = os.path.join(HOME_DIR, ".streamlit")
8
+ os.makedirs(CONFIG_DIR, exist_ok=True)
9
+
10
+ # Optional: point Streamlit explicitly here too
11
+ os.environ["STREAMLIT_CONFIG_DIR"] = CONFIG_DIR
12
+
13
+ # Optional hard-disable usage stats very early (belt & suspenders)
14
+ os.environ["STREAMLIT_BROWSER_GATHERUSAGESTATS"] = "false"
15
+ # ------------------------------------------------------------------------------
16
 
17
 
18
  import io, os, numpy as np, streamlit as st, librosa, torch, soundfile as sf