# app.py import streamlit as st import runpy # 1. Page config & title st.set_page_config(page_title="Machine Learning Models Visualization Hub") st.title("Machine Learning Models Visualization Tools") # 2. Map display names → filenames APPS = { "Gradient Descent Visualization": "gd_sgd_app.py", "Decision Tree (step-by-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", } # 3. Check for query‑param to run one of the apps params = st.experimental_get_query_params() selected = params.get("app", [None])[0] if selected in APPS.values(): # Run the selected Streamlit app in this process runpy.run_path(selected, run_name="__main__") else: # 4. Otherwise show a grid of buttons cols = st.columns(2) for idx, (label, fname) in enumerate(APPS.items()): col = cols[idx % 2] if col.button(label, key=label): # set the query‑param and rerun st.experimental_set_query_params(app=fname)