Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,35 +1,33 @@
|
|
| 1 |
-
#
|
| 2 |
import streamlit as st
|
| 3 |
import runpy
|
| 4 |
|
| 5 |
# 1. Page config & title
|
| 6 |
-
st.set_page_config(page_title="Machine Learning Models Visualization
|
| 7 |
-
st.title("Machine Learning Models Visualization
|
| 8 |
|
| 9 |
# 2. Map display names → filenames
|
| 10 |
APPS = {
|
| 11 |
-
"Gradient Descent Visualization":
|
| 12 |
-
"Decision Tree (
|
| 13 |
-
"Bagging Classifier Visualization":
|
| 14 |
-
"Bagging Regressor Visualization":
|
| 15 |
-
"Voting Classifier Visualization":
|
| 16 |
-
"Voting Regressor Visualization":
|
| 17 |
-
"Decision Tree Visualization": "decision_tree_viz.py",
|
| 18 |
}
|
| 19 |
|
| 20 |
-
# 3.
|
| 21 |
params = st.experimental_get_query_params()
|
| 22 |
selected = params.get("app", [None])[0]
|
| 23 |
|
| 24 |
if selected in APPS.values():
|
| 25 |
-
#
|
| 26 |
runpy.run_path(selected, run_name="__main__")
|
| 27 |
else:
|
| 28 |
-
# 4. Otherwise show
|
| 29 |
cols = st.columns(2)
|
| 30 |
for idx, (label, fname) in enumerate(APPS.items()):
|
| 31 |
col = cols[idx % 2]
|
| 32 |
-
# style each button like a “box”
|
| 33 |
if col.button(label, key=label):
|
| 34 |
-
# set query‑param and
|
| 35 |
st.experimental_set_query_params(app=fname)
|
|
|
|
| 1 |
+
# app.py
|
| 2 |
import streamlit as st
|
| 3 |
import runpy
|
| 4 |
|
| 5 |
# 1. Page config & title
|
| 6 |
+
st.set_page_config(page_title="Machine Learning Models Visualization Hub")
|
| 7 |
+
st.title("Machine Learning Models Visualization Tools")
|
| 8 |
|
| 9 |
# 2. Map display names → filenames
|
| 10 |
APPS = {
|
| 11 |
+
"Gradient Descent Visualization": "gd_sgd_app.py",
|
| 12 |
+
"Decision Tree (step-by-step)": "decision_tree_steps.py",
|
| 13 |
+
"Bagging Classifier Visualization": "bagging_classifier_viz.py",
|
| 14 |
+
"Bagging Regressor Visualization": "bagging_regressor_viz.py",
|
| 15 |
+
"Voting Classifier Visualization": "voting_classifier_viz.py",
|
| 16 |
+
"Voting Regressor Visualization": "voting_regressor_viz.py",
|
|
|
|
| 17 |
}
|
| 18 |
|
| 19 |
+
# 3. Check for query‑param to run one of the apps
|
| 20 |
params = st.experimental_get_query_params()
|
| 21 |
selected = params.get("app", [None])[0]
|
| 22 |
|
| 23 |
if selected in APPS.values():
|
| 24 |
+
# Run the selected Streamlit app in this process
|
| 25 |
runpy.run_path(selected, run_name="__main__")
|
| 26 |
else:
|
| 27 |
+
# 4. Otherwise show a grid of buttons
|
| 28 |
cols = st.columns(2)
|
| 29 |
for idx, (label, fname) in enumerate(APPS.items()):
|
| 30 |
col = cols[idx % 2]
|
|
|
|
| 31 |
if col.button(label, key=label):
|
| 32 |
+
# set the query‑param and rerun
|
| 33 |
st.experimental_set_query_params(app=fname)
|