| import gradio as gr |
| from spoken_module import spoken_dashboard |
| from written_module import written_dashboard |
| from file_module import file_dashboard |
|
|
|
|
| def main_app(): |
| with gr.Blocks(css="light_mode_chatter_owl.css") as app: |
| current_mode = gr.State("spoken") |
|
|
| with gr.Row(): |
| |
| with gr.Column(scale=1, min_width=220): |
| gr.Markdown("### π Educare") |
| gr.Markdown("---") |
|
|
| with gr.Accordion("π§ Learning Modes", open=True): |
| btn_spoken = gr.Button("π£ Spoken Communication") |
| btn_written = gr.Button("βοΈ Written Communication") |
| btn_file = gr.Button("π File-Based Learning") |
|
|
| gr.Markdown("---") |
| gr.Markdown(\"\"\"**Ankush Bansal** \nankban@wharton.upenn.edu\"\"\") |
| |
| # === MAIN CONTENT PANEL === |
| with gr.Column(scale=4): |
| spoken_panel = gr.Column(visible=True) |
| written_panel = gr.Column(visible=False) |
| file_panel = gr.Column(visible=False) |
| |
| with spoken_panel: |
| spoken_dashboard() |
| |
| with written_panel: |
| written_dashboard() |
| |
| with file_panel: |
| file_dashboard() |
| |
| def switch_mode(mode): |
| return ( |
| gr.update(visible=(mode == "spoken")), |
| gr.update(visible=(mode == "written")), |
| gr.update(visible=(mode == "file")), |
| mode |
| ) |
| |
| btn_spoken.click(lambda: switch_mode("spoken"), outputs=[spoken_panel, written_panel, file_panel, current_mode]) |
| btn_written.click(lambda: switch_mode("written"), outputs=[spoken_panel, written_panel, file_panel, current_mode]) |
| btn_file.click(lambda: switch_mode("file"), outputs=[spoken_panel, written_panel, file_panel, current_mode]) |
| |
| return app |
| |
| |
| if __name__ == "__main__": |
| main_app().launch(server_name="0.0.0.0", server_port=7860) |