File size: 4,075 Bytes
f16bb9f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
"""
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",
    )