Download app.py from ankban/CommTutor: direct link, hf CLI and curl.
- Browser
- Download file 2.06 kB
-
https://huggingface.co/spaces/ankban/CommTutor/resolve/8a9bac85be2eafdff407dc57b7d0ff8fd9cf19b2/app.py
- Command line
-
hf download hf://spaces/ankban/CommTutor@8a9bac85be2eafdff407dc57b7d0ff8fd9cf19b2/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ankban/CommTutor/resolve/8a9bac85be2eafdff407dc57b7d0ff8fd9cf19b2/app.py
2.06 kB
| 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) |