MASAI / app /event_handlers /event_handlers.py
DmitryRyumin's picture
Summary
f16bb9f
raw
history blame
1.41 kB
"""
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,
noti_results,
waveform,
faces,
emotion_stats,
sent_stats,
):
gr.on(
triggers=[video.change, video.upload, video.stop_recording, video.clear],
fn=event_handler_video,
inputs=[video],
outputs=[clear, submit, noti_results],
queue=True,
)
submit.click(
fn=event_handler_submit,
inputs=[video],
outputs=[
noti_results,
waveform,
faces,
emotion_stats,
sent_stats,
],
queue=True,
)
clear.click(
fn=event_handler_clear,
inputs=[],
outputs=[
video,
clear,
submit,
noti_results,
waveform,
faces,
emotion_stats,
sent_stats,
],
queue=True,
)