File size: 1,237 Bytes
855cca9
80c7d91
 
 
 
855cca9
 
80c7d91
 
 
855cca9
 
 
 
 
 
80c7d91
 
855cca9
80c7d91
 
 
 
855cca9
80c7d91
 
855cca9
80c7d91
 
 
 
855cca9
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
# 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)