Spaces:
Sleeping
Sleeping
| # 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) | |