Spaces:
Runtime error
Runtime error
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +12 -8
src/streamlit_app.py
CHANGED
|
@@ -2,16 +2,20 @@
|
|
| 2 |
|
| 3 |
import os
|
| 4 |
|
| 5 |
-
# Streamlit
|
| 6 |
-
os.environ["
|
| 7 |
-
|
|
|
|
|
|
|
| 8 |
os.environ["MPLCONFIGDIR"] = "/tmp/matplotlib"
|
| 9 |
-
# Fontconfig cache
|
| 10 |
os.environ["XDG_CACHE_HOME"] = "/tmp/fontconfig"
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
os.makedirs(
|
|
|
|
|
|
|
|
|
|
| 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()
|