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