File size: 1,803 Bytes
f16bb9f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cac01bb
f16bb9f
 
 
 
15b7f31
 
 
f16bb9f
 
 
 
 
257d039
 
 
 
 
 
 
 
 
 
 
 
f16bb9f
 
 
 
 
 
 
cac01bb
f16bb9f
 
 
 
15b7f31
 
 
f16bb9f
 
 
 
 
 
 
 
 
 
 
cac01bb
f16bb9f
 
 
 
15b7f31
 
 
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
"""
File: event_handlers.py
Author: Dmitry Ryumin, Maxim Markitantov, Elena Ryumina, Anastasia Dvoynikova, and Alexey Karpov
Description: File containing functions for configuring event handlers for Gradio components.
License: MIT License
"""

import gradio as gr

# Importing necessary components for the Gradio app
from app.event_handlers.video import event_handler_video
from app.event_handlers.submit import event_handler_submit
from app.event_handlers.clear import event_handler_clear


def setup_app_event_handlers(
    video,
    clear,
    submit,
    text,
    waveform,
    faces,
    emotion_stats,
    sent_stats,
    time_row,
    video_duration,
    calculate_time,
):
    gr.on(
        triggers=[video.change, video.upload, video.stop_recording, video.clear],
        fn=event_handler_video,
        inputs=[video],
        outputs=[
            clear,
            submit,
            text,
            waveform,
            faces,
            emotion_stats,
            sent_stats,
            time_row,
            video_duration,
            calculate_time,
        ],
        queue=True,
    )

    submit.click(
        fn=event_handler_submit,
        inputs=[video],
        outputs=[
            text,
            waveform,
            faces,
            emotion_stats,
            sent_stats,
            time_row,
            video_duration,
            calculate_time,
        ],
        queue=True,
    )

    clear.click(
        fn=event_handler_clear,
        inputs=[],
        outputs=[
            video,
            clear,
            submit,
            text,
            waveform,
            faces,
            emotion_stats,
            sent_stats,
            time_row,
            video_duration,
            calculate_time,
        ],
        queue=True,
    )