Spaces:
Running
Running
File size: 5,560 Bytes
f51c1fd 42c4f80 f51c1fd d0f716d aa2aec1 f51c1fd 42c4f80 d0f716d aa2aec1 20b6a53 d0f716d aa2aec1 b0f25b3 aa2aec1 d0f716d f51c1fd b0f25b3 aa2aec1 20b6a53 b0f25b3 aa2aec1 b0f25b3 aa2aec1 b0f25b3 42c4f80 f51c1fd 42c4f80 d0f716d aa2aec1 20b6a53 aa2aec1 b0f25b3 aa2aec1 d0f716d aa2aec1 20b6a53 aa2aec1 d0f716d aa2aec1 20b6a53 aa2aec1 d0f716d aa2aec1 b0f25b3 aa2aec1 d0f716d f51c1fd aa2aec1 |
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 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
"""
File: event_handlers.py
Author: Dmitry Ryumin
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.files import (
event_handler_files,
event_handler_files_select,
)
from app.event_handlers.examples_blocks import event_handler_examples_blocks
from app.event_handlers.clear_blocks import event_handler_clear_blocks
from app.event_handlers.calculate_pt_scores_blocks import (
event_handler_calculate_pt_scores_blocks,
)
from app.event_handlers.practical_tasks import event_handler_practical_tasks
from app.event_handlers.practical_subtasks import event_handler_practical_subtasks
from app.event_handlers.calculate_practical_tasks import (
event_handler_calculate_practical_task_blocks,
)
from app.event_handlers.practical_task_sorted import event_handler_practical_task_sorted
def setup_app_event_handlers(
notifications,
files,
video,
examples,
calculate_pt_scores,
clear_app,
pt_scores,
csv_pt_scores,
practical_tasks,
practical_subtasks,
settings_practical_tasks,
threshold_professional_skills,
dropdown_professional_skills,
target_score_ope,
target_score_con,
target_score_ext,
target_score_agr,
target_score_nneu,
equal_coefficient,
calculate_practical_task,
practical_subtasks_selected,
practical_tasks_column,
sorted_videos,
sorted_videos_column,
practical_task_sorted,
csv_practical_task_sorted,
video_sorted,
in_development,
):
# Events
files.change(
event_handler_files,
[files],
[notifications, video, calculate_pt_scores, clear_app],
queue=True,
)
files.select(
event_handler_files_select,
[files],
[video],
queue=True,
)
gr.on(
triggers=[calculate_pt_scores.click],
fn=event_handler_calculate_pt_scores_blocks,
inputs=[
files,
],
outputs=[
notifications,
pt_scores,
csv_pt_scores,
practical_tasks_column,
practical_tasks,
practical_subtasks,
practical_subtasks_selected,
settings_practical_tasks,
threshold_professional_skills,
dropdown_professional_skills,
target_score_ope,
target_score_con,
target_score_ext,
target_score_agr,
target_score_nneu,
equal_coefficient,
calculate_practical_task,
sorted_videos,
sorted_videos_column,
practical_task_sorted,
csv_practical_task_sorted,
video_sorted,
in_development,
],
queue=True,
)
examples.click(
fn=event_handler_examples_blocks,
inputs=[],
outputs=[
files,
],
queue=True,
)
clear_app.click(
fn=event_handler_clear_blocks,
inputs=[],
outputs=[
notifications,
files,
video,
calculate_pt_scores,
clear_app,
pt_scores,
csv_pt_scores,
practical_tasks_column,
practical_tasks,
practical_subtasks,
practical_subtasks_selected,
settings_practical_tasks,
threshold_professional_skills,
dropdown_professional_skills,
target_score_ope,
target_score_con,
target_score_ext,
target_score_agr,
target_score_nneu,
equal_coefficient,
sorted_videos,
sorted_videos_column,
practical_task_sorted,
csv_practical_task_sorted,
video_sorted,
in_development,
],
queue=True,
)
practical_tasks.change(
event_handler_practical_tasks,
[practical_tasks, practical_subtasks_selected],
[practical_subtasks],
queue=True,
)
practical_subtasks.change(
event_handler_practical_subtasks,
[practical_tasks, practical_subtasks, practical_subtasks_selected],
[
practical_subtasks_selected,
settings_practical_tasks,
threshold_professional_skills,
dropdown_professional_skills,
target_score_ope,
target_score_con,
target_score_ext,
target_score_agr,
target_score_nneu,
equal_coefficient,
],
queue=True,
)
calculate_practical_task.click(
fn=event_handler_calculate_practical_task_blocks,
inputs=[
files,
practical_subtasks,
pt_scores,
threshold_professional_skills,
dropdown_professional_skills,
target_score_ope,
target_score_con,
target_score_ext,
target_score_agr,
target_score_nneu,
equal_coefficient,
],
outputs=[
sorted_videos,
sorted_videos_column,
practical_task_sorted,
csv_practical_task_sorted,
video_sorted,
in_development,
],
queue=True,
)
practical_task_sorted.select(
event_handler_practical_task_sorted,
[files, practical_task_sorted],
[video_sorted],
queue=True,
)
|