ankban commited on
Commit
e1649ae
Β·
verified Β·
1 Parent(s): df83b64

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -11
app.py CHANGED
@@ -10,24 +10,28 @@ def main_app():
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()
@@ -38,20 +42,25 @@ ankban@wharton.upenn.edu""")
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)
 
10
 
11
  with gr.Row():
12
  # === LEFT SIDEBAR ===
13
+ with gr.Column(scale=1, min_width=220, elem_id="sidebar"):
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
+
21
+ with gr.Accordion("πŸ“„ File-Based Learning", open=False):
22
+ btn_file_study = gr.Button("πŸ“˜ Study Guides")
23
+ btn_file_view = gr.Button("πŸ“ Files")
24
 
25
  gr.Markdown("---")
26
+ with gr.Row():
27
+ gr.Markdown("""<div style='position: absolute; bottom: 1rem;'>**Ankush Bansal**<br>ankban@wharton.upenn.edu</div>""", elem_id="sidebar-user")
28
 
29
  # === MAIN CONTENT PANEL ===
30
  with gr.Column(scale=4):
31
+ spoken_panel = gr.Box(visible=True)
32
+ written_panel = gr.Box(visible=False)
33
+ file_panel = gr.Box(visible=False)
34
+ file_study_panel = gr.Box(visible=False)
35
 
36
  with spoken_panel:
37
  spoken_dashboard()
 
42
  with file_panel:
43
  file_dashboard()
44
 
45
+ with file_study_panel:
46
+ file_dashboard() # temporary reuse; can split later
47
+
48
  def switch_mode(mode):
49
  return (
50
  gr.update(visible=(mode == "spoken")),
51
  gr.update(visible=(mode == "written")),
52
  gr.update(visible=(mode == "file")),
53
+ gr.update(visible=(mode == "study")),
54
  mode
55
  )
56
 
57
+ btn_spoken.click(lambda: switch_mode("spoken"), outputs=[spoken_panel, written_panel, file_panel, file_study_panel, current_mode])
58
+ btn_written.click(lambda: switch_mode("written"), outputs=[spoken_panel, written_panel, file_panel, file_study_panel, current_mode])
59
+ btn_file_view.click(lambda: switch_mode("file"), outputs=[spoken_panel, written_panel, file_panel, file_study_panel, current_mode])
60
+ btn_file_study.click(lambda: switch_mode("study"), outputs=[spoken_panel, written_panel, file_panel, file_study_panel, current_mode])
61
 
62
  return app
63
 
64
 
65
  if __name__ == "__main__":
66
+ main_app().launch(server_name="0.0.0.0", server_port=7860)