Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# homepage.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 tools")
|
| 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 (each 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 |
+
"Decision Tree Visualization": "decision_tree_viz.py",
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
# 3. See if the user clicked into one of the apps already
|
| 21 |
+
params = st.experimental_get_query_params()
|
| 22 |
+
selected = params.get("app", [None])[0]
|
| 23 |
+
|
| 24 |
+
if selected in APPS.values():
|
| 25 |
+
# rerun the selected app
|
| 26 |
+
runpy.run_path(selected, run_name="__main__")
|
| 27 |
+
else:
|
| 28 |
+
# 4. Otherwise show the grid of buttons
|
| 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 trigger rerun
|
| 35 |
+
st.experimental_set_query_params(app=fname)
|