MASAI / app /event_handlers /event_handlers.py
DmitryRyumin's picture
Summary
257d039
"""
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,
)