""" app.py โ€” Main Streamlit entry point for No-CelH Self-Learning RMS Run: streamlit run app.py Hugging Face Spaces: set SDK=streamlit, app_file=app.py """ import streamlit as st st.set_page_config( page_title="No-CelH ยท Self-Learning RMS", page_icon="๐Ÿ›ƒ", layout="wide", initial_sidebar_state="expanded", menu_items={ "Get Help": "https://www.wcoomd.org/en/topics/enforcement-and-compliance/activities-and-programmes/risk-management.aspx", "Report a bug": None, "About": "No-CelH: Self-Learning RMS โ€” WCO Accredited Expert Simulation Tool\n\nBuilt on DATE + gATE Active Learning (Kim et al. 2022, IEEE TKDE)", }, ) import page1_intro import page2_risk_register import page3_simulation import page4_results import page5_optimisation from styles import WCO_GOLD, WCO_NAVY, WCO_BORDER, WCO_CARD_BG, WCO_MUTED, WCO_RED, WCO_GREEN PAGES = { "๐Ÿ  Introduction & Architecture": page1_intro, "๐Ÿ“‹ Risk Register & Matrix": page2_risk_register, "๐Ÿ”„ Simulation Engine": page3_simulation, "๐Ÿ“Š Simulation Results": page4_results, "๐Ÿ† Bandwidth Optimisation": page5_optimisation, } def sidebar(): with st.sidebar: st.markdown(f"""
๐Ÿ›ƒ
No-CelH
Self-Learning RMS
WCO ACCREDITED ยท v2.0

""", unsafe_allow_html=True) st.markdown(f"""
Navigation
""", unsafe_allow_html=True) selected = st.radio("", list(PAGES.keys()), key="nav_page", label_visibility="collapsed") st.markdown(f"
", unsafe_allow_html=True) # Session state status panel sim_ready = "sim_df" in st.session_state st.markdown(f"""
Session Status
{'โœ…' if sim_ready else 'โฌœ'} Simulation Run
{'โœ…' if 'rule_weights' in st.session_state else 'โฌœ'} Weights Configured
{'โœ…' if 'sim_efficiency' in st.session_state else 'โฌœ'} Results Available
""", unsafe_allow_html=True) if sim_ready: df = st.session_state.sim_df eff = st.session_state.get("sim_efficiency", {}).get("hybrid", {}) st.markdown(f"""
Last Simulation
๐Ÿ“ฆ Bills: {len(df):,}
๐Ÿ”ด RED: {(df['channel']=='RED').sum()}
๐ŸŸก YEL: {(df['channel']=='YELLOW').sum()}
๐ŸŸข GRN: {(df['channel']=='GREEN').sum()}
๐Ÿšจ Detected: {(df['inspection_outcome']=='FRAUD_DETECTED').sum()}
๐Ÿ“ˆ Efficiency: {eff.get('efficiency_index',0):.3f}
""", unsafe_allow_html=True) st.markdown(f"""
Based on: Kim et al. (2022)
Active Learning for Human-in-the-Loop Customs Inspection
IEEE TKDE ยท WCO Compendium
WCO BACUDA Initiative
""", unsafe_allow_html=True) return selected def main(): selected = sidebar() PAGES[selected].show() if __name__ == "__main__": main()