Multi page app in streamlit based on condition

Hi @aqib,

Welcome to the st.party!

You could clone my simple authlib, announced here, then do this:

import streamlit as st
from authlib.auth import auth, authenticated

# Adds a login expander control to top of page
user = auth(sidebar=True, show_msgs=True)

st.title('Test App')

if authenticated():
    app = MultiApp()
    app.add_app("Home", home.app)
    app.add_app("Prediction UI", data.app)
    app.add_app("Train Models", model.app)
    app.add_app("Get Data", getData.app)
    app.add_app("List Models",listModels.app)
    app.add_app("Dynamic UI for Training",dynamicUiForTraining.app)
    app.add_app("Dynamic UI for Predictions",dynamicUiPredictions.app)
    app.add_app("Explain Models UI", explain_models.app)
    # The main app
    app.run()
else:
    st.warning("Please login above to access the application.")

HTH,
Arvindra

2 Likes