Hello I am bigginer at streamlit and i want when i am on the sidebar and i select one model i want to be redirected in route in navarbar bar also for exemple when i select mode1 on the sidebar the navar must be in model 1

import hydralit as hy
import streamlit as st
import hydralit_components as hc

app = hy.HydraApp(title=‘Secure Hydralit Data Explorer’,
favicon=“:rocket:”,hide_streamlit_markers=True,
use_navbar=True, navbar_sticky=True,
# banner_spacing=[30,20,40,30,10]
)

def get_selected_model():
with st.sidebar:
expander = st.expander(“Ml-Engineering”)
with st.expander(“Machine Learning”):
selected_model = None
if st.button(“Model 1”):
selected_model = “model1”
elif st.button(“Model 2”):
selected_model = “model2”
return selected_model

@app.addapp(title=‘Modele 1’)

@app.addapp(title=‘AI_n_BD’, icon=“:smiling_face_with_three_hearts:”)

def model1():
hy.info(‘Hello form model1’)
@app.addapp(title=‘Modele 2’)
def model2():
hy.info(‘Hello form modele 2’)

selected_model = get_selected_model()

Redirect based on selection

if selected_model == “model1”:
model1()
elif selected_model == “model2”:
model2()
else:

Display default content if no model is selected

st.write(“Please select a model from the sidebar.”)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.