Rasleen commited on
Commit
14d304f
·
verified ·
1 Parent(s): b7d19f1

Update src/app.py

Browse files
Files changed (1) hide show
  1. src/app.py +18 -10
src/app.py CHANGED
@@ -1,9 +1,16 @@
1
  import os
2
 
3
- # Redirect all config/cache paths to /tmp
4
  os.environ["HOME"] = "/tmp"
 
5
  os.environ["STREAMLIT_HOME"] = "/tmp"
6
  os.environ["STREAMLIT_CONFIG_DIR"] = "/tmp/.streamlit"
 
 
 
 
 
 
 
7
  os.environ["ULTRALYTICS_SETTINGS_DIR"] = "/tmp/ultralytics"
8
  os.environ["MPLCONFIGDIR"] = "/tmp/matplotlib"
9
 
@@ -11,17 +18,18 @@ os.environ["MPLCONFIGDIR"] = "/tmp/matplotlib"
11
  os.makedirs("/tmp/.streamlit", exist_ok=True)
12
  os.makedirs("/tmp/ultralytics", exist_ok=True)
13
  os.makedirs("/tmp/matplotlib", exist_ok=True)
14
-
15
- # Set a minimal config for Streamlit
16
  with open("/tmp/.streamlit/config.toml", "w") as f:
17
- f.write("""
18
- [server]
19
- headless = true
20
- enableCORS = false
21
- port = 7860
22
- """)
 
 
 
 
23
 
24
- os.environ["STREAMLIT_USAGE_STATISTICS"] = "false"
25
 
26
  # Patch event loop to avoid RuntimeError
27
  # import asyncio
 
1
  import os
2
 
 
3
  os.environ["HOME"] = "/tmp"
4
+ os.environ["XDG_CONFIG_HOME"] = "/tmp" # This is critical for many config writes
5
  os.environ["STREAMLIT_HOME"] = "/tmp"
6
  os.environ["STREAMLIT_CONFIG_DIR"] = "/tmp/.streamlit"
7
+ os.environ["STREAMLIT_CONFIG_FILE"] = "/tmp/.streamlit/config.toml" # << Add this
8
+ os.environ["STREAMLIT_USAGE_STATISTICS"] = "false"
9
+
10
+ # Redirect all config/cache paths to /tmp
11
+ # os.environ["HOME"] = "/tmp"
12
+ # os.environ["STREAMLIT_HOME"] = "/tmp"
13
+ # os.environ["STREAMLIT_CONFIG_DIR"] = "/tmp/.streamlit"
14
  os.environ["ULTRALYTICS_SETTINGS_DIR"] = "/tmp/ultralytics"
15
  os.environ["MPLCONFIGDIR"] = "/tmp/matplotlib"
16
 
 
18
  os.makedirs("/tmp/.streamlit", exist_ok=True)
19
  os.makedirs("/tmp/ultralytics", exist_ok=True)
20
  os.makedirs("/tmp/matplotlib", exist_ok=True)
 
 
21
  with open("/tmp/.streamlit/config.toml", "w") as f:
22
+ f.write("[server]\nheadless = true\nport = 7860\n")
23
+
24
+ # Set a minimal config for Streamlit
25
+ # with open("/tmp/.streamlit/config.toml", "w") as f:
26
+ # f.write("""
27
+ # [server]
28
+ # headless = true
29
+ # enableCORS = false
30
+ # port = 7860
31
+ # """)
32
 
 
33
 
34
  # Patch event loop to avoid RuntimeError
35
  # import asyncio