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.authors import AUTHORS | |
| from app.config import config_data | |
| 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=False, | |
| 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(config_data.StaticPaths_EXAMPLES, [video]) | |
| with gr.Column( | |
| visible=True, | |
| render=True, | |
| variant="default", | |
| elem_classes="results-container", | |
| ): | |
| text = gr.Textbox( | |
| value=config_data.InformationMessages_NOTI_RESULTS[0], | |
| max_lines=10, | |
| placeholder=None, | |
| label=None, | |
| info=None, | |
| show_label=False, | |
| container=False, | |
| interactive=False, | |
| visible=True, | |
| autofocus=False, | |
| autoscroll=True, | |
| render=True, | |
| type="text", | |
| show_copy_button=False, | |
| max_length=config_data.General_TEXT_MAX_LENGTH, | |
| elem_classes="noti-results-false", | |
| ) | |
| 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", | |
| ) | |
| with gr.Row( | |
| visible=False, | |
| render=True, | |
| variant="default", | |
| elem_classes="time-container", | |
| ) as time_row: | |
| video_duration = gr.Textbox( | |
| value=None, | |
| max_lines=1, | |
| placeholder=None, | |
| label=None, | |
| info=None, | |
| show_label=False, | |
| container=False, | |
| interactive=False, | |
| visible=False, | |
| autofocus=False, | |
| autoscroll=True, | |
| render=True, | |
| type="text", | |
| show_copy_button=False, | |
| max_length=50, | |
| elem_classes="video_duration", | |
| ) | |
| calculate_time = gr.Textbox( | |
| value=None, | |
| max_lines=1, | |
| placeholder=None, | |
| label=None, | |
| info=None, | |
| show_label=False, | |
| container=False, | |
| interactive=False, | |
| visible=False, | |
| autofocus=False, | |
| autoscroll=True, | |
| render=True, | |
| type="text", | |
| show_copy_button=False, | |
| max_length=50, | |
| elem_classes="calculate_time", | |
| ) | |
| return ( | |
| video, | |
| clear, | |
| submit, | |
| text, | |
| waveform, | |
| faces, | |
| emotion_stats, | |
| sent_stats, | |
| time_row, | |
| video_duration, | |
| calculate_time, | |
| ) | |
| # def settings_app_tab(): | |
| # pass | |
| # def about_app_tab(): | |
| # pass | |
| def about_authors_tab(): | |
| return gr.HTML(value=AUTHORS) | |
| 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", | |
| max_height=1000, | |
| ) | |