import streamlit as st # โœ… Must be the first command st.set_page_config(page_title="TransPolymer", layout="wide", page_icon="๐Ÿงช") # โœ… Import your page modules import home import prediction import about import contact # โœ… Navigation Sidebar st.sidebar.title("๐Ÿ”— Navigation") page = st.sidebar.radio("Select a Page", ["Home", "Predictions", "About", "Contact"]) # โœ… Optional: Override via URL (?page=Contact) query_params = st.query_params if "page" in query_params: param_page = query_params["page"][0].capitalize() if param_page in ["Home", "Predictions", "About", "Contact"]: page = param_page # โœ… Page loading logic def load_page(page_name): if page_name == "Home": home.show() elif page_name == "Predictions": # Add user input for SMILES here smiles = st.text_input("Enter SMILES for polymer prediction:") if smiles: # Only call prediction.show() if SMILES is provided prediction.show(smiles) # Pass SMILES to the prediction function else: st.write("Please enter a valid SMILES string.") elif page_name == "About": about.show() elif page_name == "Contact": contact.show() else: st.error("Page not found.") # โœ… Load the selected page load_page(page)