Update app.py
Browse files
app.py
CHANGED
|
@@ -3,42 +3,55 @@ from spoken_module import spoken_dashboard
|
|
| 3 |
from written_module import written_dashboard
|
| 4 |
from file_module import file_dashboard
|
| 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 |
if __name__ == "__main__":
|
| 44 |
-
|
|
|
|
| 3 |
from written_module import written_dashboard
|
| 4 |
from file_module import file_dashboard
|
| 5 |
|
| 6 |
+
|
| 7 |
+
def main_app():
|
| 8 |
+
with gr.Blocks(css="light_mode_chatter_owl.css") as app:
|
| 9 |
+
current_mode = gr.State("spoken")
|
| 10 |
+
|
| 11 |
+
with gr.Row():
|
| 12 |
+
# === LEFT SIDEBAR ===
|
| 13 |
+
with gr.Column(scale=1, min_width=220):
|
| 14 |
+
gr.Markdown("### π Educare")
|
| 15 |
+
gr.Markdown("---")
|
| 16 |
+
|
| 17 |
+
with gr.Accordion("π§ Learning Modes", open=True):
|
| 18 |
+
btn_spoken = gr.Button("π£ Spoken Communication")
|
| 19 |
+
btn_written = gr.Button("βοΈ Written Communication")
|
| 20 |
+
btn_file = gr.Button("π File-Based Learning")
|
| 21 |
+
|
| 22 |
+
gr.Markdown("---")
|
| 23 |
+
gr.Markdown("**Ankush Bansal**
|
| 24 |
+
ankban@wharton.upenn.edu")
|
| 25 |
+
|
| 26 |
+
# === MAIN CONTENT PANEL ===
|
| 27 |
+
with gr.Column(scale=4):
|
| 28 |
+
spoken_panel = gr.Column(visible=True)
|
| 29 |
+
written_panel = gr.Column(visible=False)
|
| 30 |
+
file_panel = gr.Column(visible=False)
|
| 31 |
+
|
| 32 |
+
with spoken_panel:
|
| 33 |
+
spoken_dashboard()
|
| 34 |
+
|
| 35 |
+
with written_panel:
|
| 36 |
+
written_dashboard()
|
| 37 |
+
|
| 38 |
+
with file_panel:
|
| 39 |
+
file_dashboard()
|
| 40 |
+
|
| 41 |
+
def switch_mode(mode):
|
| 42 |
+
return (
|
| 43 |
+
gr.update(visible=(mode == "spoken")),
|
| 44 |
+
gr.update(visible=(mode == "written")),
|
| 45 |
+
gr.update(visible=(mode == "file")),
|
| 46 |
+
mode
|
| 47 |
+
)
|
| 48 |
+
|
| 49 |
+
btn_spoken.click(lambda: switch_mode("spoken"), outputs=[spoken_panel, written_panel, file_panel, current_mode])
|
| 50 |
+
btn_written.click(lambda: switch_mode("written"), outputs=[spoken_panel, written_panel, file_panel, current_mode])
|
| 51 |
+
btn_file.click(lambda: switch_mode("file"), outputs=[spoken_panel, written_panel, file_panel, current_mode])
|
| 52 |
+
|
| 53 |
+
return app
|
| 54 |
|
| 55 |
|
| 56 |
if __name__ == "__main__":
|
| 57 |
+
main_app().launch(server_name="0.0.0.0", server_port=7860)
|