Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import subprocess | |
| import os | |
| st.set_page_config(page_title="ML Visualizations Launcher", layout="wide") | |
| st.title("Machine Learning Visualizations Dashboard") | |
| # List of available apps with display names and ports | |
| APPS = { | |
| "Decision Tree -> decision_tree_steps": { | |
| "file": "decision_tree_steps.py", | |
| "port": 8502 | |
| }, | |
| "Voting Regressor -> voting_regressor_viz": { | |
| "file": "voting_regressor_viz.py", | |
| "port": 8503 | |
| }, | |
| "Voting Classifier -> voting_classifier_viz": { | |
| "file": "voting_classifier_viz.py", | |
| "port": 8504 | |
| }, | |
| "Bagging Regressor -> bagging_regressor_viz": { | |
| "file": "bagging_regressor_viz.py", | |
| "port": 8505 | |
| }, | |
| "Bagging Classifier -> bagging_classifier_viz": { | |
| "file": "bagging_classifier_viz.py", | |
| "port": 8506 | |
| }, | |
| "GD/SGD Visualizer -> gd_sgd_app": { | |
| "file": "gd_sgd_app.py", | |
| "port": 8507 | |
| } | |
| } | |
| def launch_app(file_path, port): | |
| """Launch a Streamlit app in a subprocess""" | |
| cmd = f"streamlit run {file_path} --server.port {port}" | |
| subprocess.Popen(cmd, shell=True) | |
| # Create columns for app launcher buttons | |
| col1, col2, col3 = st.columns(3) | |
| with col1: | |
| for app_name in list(APPS.keys())[::3]: | |
| app = APPS[app_name] | |
| if os.path.exists(app["file"]): | |
| if st.button(f"π {app_name}"): | |
| launch_app(app["file"], app["port"]) | |
| st.toast(f"Opening {app_name} on port {app['port']}", icon="β ") | |
| else: | |
| st.error(f"Missing file: {app['file']}") | |
| with col2: | |
| for app_name in list(APPS.keys())[1::3]: | |
| app = APPS[app_name] | |
| if os.path.exists(app["file"]): | |
| if st.button(f"π {app_name}"): | |
| launch_app(app["file"], app["port"]) | |
| st.toast(f"Opening {app_name} on port {app['port']}", icon="β ") | |
| else: | |
| st.error(f"Missing file: {app['file']}") | |
| with col3: | |
| for app_name in list(APPS.keys())[2::3]: | |
| app = APPS[app_name] | |
| if os.path.exists(app["file"]): | |
| if st.button(f"π {app_name}"): | |
| launch_app(app["file"], app["port"]) | |
| st.toast(f"Opening {app_name} on port {app['port']}", icon="β ") | |
| else: | |
| st.error(f"Missing file: {app['file']}") | |
| st.markdown("---") | |
| st.info("βΉοΈ For each app click the mapped sidebar because as of now the ports aren't working so simply click the sidebar option to play around") | |