Spaces:
Sleeping
Sleeping
File size: 2,508 Bytes
80c7d91 e829bef 80c7d91 e829bef 80c7d91 e829bef 80c7d91 f8f4d54 e829bef 1a692dd e829bef 1a692dd e829bef 1a692dd e829bef 1a692dd e829bef 1a692dd e829bef 80c7d91 e829bef 1a692dd |
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
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")
|