celik-muhammed commited on
Commit
5a695e2
·
verified ·
1 Parent(s): 695d84c

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +12 -8
src/streamlit_app.py CHANGED
@@ -2,16 +2,20 @@
2
 
3
  import os
4
 
5
- # Streamlit config and metrics
6
- os.environ["STREAMLIT_CONFIG_DIR"] = "/tmp/streamlit"
7
- # Matplotlib cache directory
 
 
8
  os.environ["MPLCONFIGDIR"] = "/tmp/matplotlib"
9
- # Fontconfig cache
10
  os.environ["XDG_CACHE_HOME"] = "/tmp/fontconfig"
11
- # Create the directories
12
- os.makedirs("/tmp/streamlit", exist_ok=True)
13
- os.makedirs("/tmp/matplotlib", exist_ok=True)
14
- os.makedirs("/tmp/fontconfig", exist_ok=True)
 
 
 
15
 
16
  from scikitplot.streamlit import template_st_app
17
  template_st_app.run_app_ui()
 
2
 
3
  import os
4
 
5
+ # Set a safe HOME directory for Streamlit to write to
6
+ os.environ["HOME"] = "/tmp"
7
+ os.environ["STREAMLIT_CONFIG_DIR"] = "/tmp/.streamlit"
8
+
9
+ # Also fix matplotlib and fontconfig if needed
10
  os.environ["MPLCONFIGDIR"] = "/tmp/matplotlib"
 
11
  os.environ["XDG_CACHE_HOME"] = "/tmp/fontconfig"
12
+
13
+ # Make sure dirs exist
14
+ for path in ["/tmp/.streamlit", "/tmp/matplotlib", "/tmp/fontconfig"]:
15
+ os.makedirs(path, exist_ok=True)
16
+
17
+ # Now import your app modules
18
+ import streamlit as st
19
 
20
  from scikitplot.streamlit import template_st_app
21
  template_st_app.run_app_ui()