Spaces:
Running
on
Zero
Running
on
Zero
| """ | |
| File: tabs.py | |
| Author: Dmitry Ryumin, Maxim Markitantov, Elena Ryumina, Anastasia Dvoynikova, and Alexey Karpov | |
| Description: Gradio app tabs - Contains the definition of various tabs for the Gradio app interface. | |
| License: MIT License | |
| """ | |
| import gradio as gr | |
| # Importing necessary components for the Gradio app | |
| from app.description import DESCRIPTION | |
| from app.config import config_data | |
| from app.components import html_message | |
| from app.requirements_app import read_requirements | |
| def app_tab(): | |
| gr.Markdown(value=DESCRIPTION) | |
| with gr.Row( | |
| visible=True, | |
| render=True, | |
| variant="default", | |
| elem_classes="app-container", | |
| ): | |
| with gr.Column( | |
| visible=True, | |
| render=True, | |
| variant="default", | |
| elem_classes="video-container", | |
| ): | |
| video = gr.Video( | |
| label=config_data.Labels_VIDEO, | |
| show_label=True, | |
| interactive=True, | |
| visible=True, | |
| mirror_webcam=True, | |
| include_audio=True, | |
| elem_classes="video", | |
| autoplay=False, | |
| ) | |
| with gr.Row( | |
| visible=True, | |
| render=True, | |
| variant="default", | |
| elem_classes="submit-container", | |
| ): | |
| clear = gr.Button( | |
| value=config_data.OtherMessages_CLEAR, | |
| interactive=False, | |
| icon=config_data.Path_APP | |
| / config_data.StaticPaths_IMAGES | |
| / "clear.ico", | |
| visible=True, | |
| elem_classes="clear", | |
| ) | |
| submit = gr.Button( | |
| value=config_data.OtherMessages_SUBMIT, | |
| interactive=False, | |
| icon=config_data.Path_APP | |
| / config_data.StaticPaths_IMAGES | |
| / "submit.ico", | |
| visible=True, | |
| elem_classes="submit", | |
| ) | |
| gr.Examples( | |
| [ | |
| "videos/1.mp4", | |
| "videos/2.mp4", | |
| ], | |
| [video], | |
| ) | |
| with gr.Column( | |
| visible=True, | |
| render=True, | |
| variant="default", | |
| elem_classes="results-container", | |
| ): | |
| noti_results = html_message( | |
| message=config_data.InformationMessages_NOTI_RESULTS[0], | |
| error=True, | |
| visible=True, | |
| ) | |
| waveform = gr.Plot( | |
| value=None, | |
| label=config_data.Labels_WAVEFORM, | |
| show_label=True, | |
| visible=False, | |
| elem_classes="audio", | |
| ) | |
| faces = gr.Plot( | |
| value=None, | |
| label=config_data.Labels_FACE_IMAGES, | |
| show_label=True, | |
| visible=False, | |
| elem_classes="imgs", | |
| ) | |
| emotion_stats = gr.Plot( | |
| value=None, | |
| label=config_data.Labels_EMO_STATS, | |
| show_label=True, | |
| visible=False, | |
| elem_classes="emo-stats", | |
| ) | |
| sent_stats = gr.Plot( | |
| value=None, | |
| label=config_data.Labels_SENT_STATS, | |
| show_label=True, | |
| visible=False, | |
| elem_classes="sent-stats", | |
| ) | |
| return ( | |
| video, | |
| clear, | |
| submit, | |
| noti_results, | |
| waveform, | |
| faces, | |
| emotion_stats, | |
| sent_stats, | |
| ) | |
| def settings_app_tab(): | |
| pass | |
| def about_app_tab(): | |
| pass | |
| def about_authors_tab(): | |
| pass | |
| def requirements_app_tab(): | |
| reqs = read_requirements() | |
| return gr.Dataframe( | |
| headers=reqs.columns, | |
| value=reqs, | |
| datatype=["markdown"] * len(reqs.columns), | |
| visible=True, | |
| elem_classes="requirements-dataframe", | |
| type="polars", | |
| ) | |