File size: 2,055 Bytes
b0d77d1
 
4080454
dba79e8
fee1ded
e0ba2d0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0be1519
 
 
e0ba2d0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ac86e3d
b67dec4
981c6f0
e0ba2d0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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():
            # === LEFT SIDEBAR ===
            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**  
ankban@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)