import gradio as gr from state.app_state import AppState from ui.styles import DATA_SELECTOR_CSS from ui.assets import LOGOS from ui.tabs.data_tab import build as build_data_tab from ui.tabs.estimation.descriptive_tab import build as build_descriptive_tab from ui.tabs.estimation.inference_tab import build as build_inference_tab from ui.tabs.estimation.graphical_tab import build as build_graphical_tab from ui.tabs.hypothesis_testing_tab import build as build_hypothesis_tab from ui.tabs.linear_regression_tab import build as build_linear_regression_tab def build_layout(): """ Global application layout. Responsibilities: - Instantiate AppState once - Apply theme and CSS globally - Render persistent header (logos + title) - Define main navigation tabs """ state = AppState() with gr.Blocks( title="Thotsakan Statistics", ) as demo: # ================================================== # Global header (always visible) # ================================================== with gr.Row(equal_height=True): gr.Image(LOGOS["thotsakan"], height=80, show_label=False) gr.Image(LOGOS["cmkl"], height=80, show_label=False) gr.Image(LOGOS["aice"], height=80, show_label=False) #gr.Image(LOGOS["himmapan"], height=80, show_label=False) gr.Markdown( """ # Thotsakan Statistics *Probability and Statistics Interactive Laboratory* """ ) # ================================================== # Main application tabs # ================================================== with gr.Tabs(): # ------------------------- # Home # ------------------------- with gr.Tab("๐Ÿ  Home"): gr.Markdown("What is Himmapan lab. Its goal, its vision, products.") gr.Markdown("What is Thotsakan Statistics. Links to repository.") # ------------------------- # Data # ------------------------- with gr.Tab("๐Ÿ“ Data"): build_data_tab(state) # ------------------------- # Probability # ------------------------- with gr.Tab("๐ŸŽฒ Probability"): with gr.Tabs(): with gr.Tab("๐Ÿ“œ Common Distributions"): gr.Markdown("๐Ÿšง Building.") with gr.Tab("โœ๏ธ Custom Distribution"): gr.Markdown("๐Ÿšง Building.") with gr.Tab("๐Ÿค Approximations"): gr.Markdown("๐Ÿšง Building.") # ------------------------- # Estimation # ------------------------- with gr.Tab("๐Ÿ“ Estimation"): with gr.Tabs(): with gr.Tab("๐Ÿงฎ Descriptive Statistics"): build_descriptive_tab(state) with gr.Tab("๐Ÿ’ญ Statistical Inference"): build_inference_tab(state) with gr.Tab("๐Ÿ“Š Graphical Analysis"): build_graphical_tab(state) # ------------------------- # Hypothesis Testing # ------------------------- with gr.Tab("๐Ÿงช Hypothesis Testing"): build_hypothesis_tab(state) # ------------------------- # Linear Regression # ------------------------- with gr.Tab("๐Ÿ“ˆ Linear Regression"): build_linear_regression_tab(state) gr.Markdown("### ๐Ÿค“ Developed by Himmapan Lab at CMKL University, version 5.0.0, February 2026.") return demo, gr.themes.Soft(), DATA_SELECTOR_CSS