Spaces:
Running
Running
File size: 5,838 Bytes
d0f716d aa2aec1 d0f716d aa2aec1 0e30f40 d0f716d aa2aec1 0e30f40 aa2aec1 0e30f40 aa2aec1 0e30f40 aa2aec1 0e30f40 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 |
"""
File: practical_subtasks.py
Author: Elena Ryumina and Dmitry Ryumin
Description: Event handler for Gradio app to filter practical subtasks based on selected practical subtasks.
License: MIT License
"""
import gradio as gr
# Importing necessary components for the Gradio app
from app.config import config_data
from app.components import number_create_ui, dropdown_create_ui
def event_handler_practical_subtasks(
practical_tasks, practical_subtasks, practical_subtasks_selected
):
practical_subtasks_selected[practical_tasks] = practical_subtasks
if practical_subtasks.lower() == "professional skills":
return (
practical_subtasks_selected,
gr.Column(visible=True),
number_create_ui(
value=0.5,
minimum=0.0,
maximum=1.0,
step=0.01,
label=config_data.Labels_THRESHOLD_PROFESSIONAL_SKILLS_LABEL,
info=config_data.InformationMessages_THRESHOLD_PROFESSIONAL_SKILLS_INFO,
show_label=True,
interactive=True,
visible=True,
render=True,
elem_classes="number-container",
),
dropdown_create_ui(
label=f"Professional skills ({len(config_data.Settings_DROPDOWN_PROFESSIONAL_SKILLS)})",
info=config_data.InformationMessages_DROPDOWN_PROFESSIONAL_SKILLS_INFO,
choices=config_data.Settings_DROPDOWN_PROFESSIONAL_SKILLS,
value=config_data.Settings_DROPDOWN_PROFESSIONAL_SKILLS[0],
visible=True,
elem_classes="dropdown-container",
),
number_create_ui(visible=False),
number_create_ui(visible=False),
number_create_ui(visible=False),
number_create_ui(visible=False),
number_create_ui(visible=False),
number_create_ui(visible=False),
)
elif (
practical_subtasks.lower() == "finding a suitable junior colleague"
or practical_subtasks.lower() == "finding a suitable senior colleague"
):
return (
practical_subtasks_selected,
gr.Column(visible=True),
number_create_ui(visible=False),
dropdown_create_ui(visible=False),
number_create_ui(
value=config_data.Values_TARGET_SCORES[0],
minimum=0.0,
maximum=1.0,
step=0.000001,
label=config_data.Labels_TARGET_SCORE_OPE_LABEL,
info=config_data.InformationMessages_TARGET_SCORE_OPE_INFO,
show_label=True,
interactive=True,
visible=True,
render=True,
elem_classes="number-container",
),
number_create_ui(
value=config_data.Values_TARGET_SCORES[1],
minimum=0.0,
maximum=1.0,
step=0.000001,
label=config_data.Labels_TARGET_SCORE_CON_LABEL,
info=config_data.InformationMessages_TARGET_SCORE_CON_INFO,
show_label=True,
interactive=True,
visible=True,
render=True,
elem_classes="number-container",
),
number_create_ui(
value=config_data.Values_TARGET_SCORES[2],
minimum=0.0,
maximum=1.0,
step=0.000001,
label=config_data.Labels_TARGET_SCORE_EXT_LABEL,
info=config_data.InformationMessages_TARGET_SCORE_EXT_INFO,
show_label=True,
interactive=True,
visible=True,
render=True,
elem_classes="number-container",
),
number_create_ui(
value=config_data.Values_TARGET_SCORES[3],
minimum=0.0,
maximum=1.0,
step=0.000001,
label=config_data.Labels_TARGET_SCORE_AGR_LABEL,
info=config_data.InformationMessages_TARGET_SCORE_AGR_INFO,
show_label=True,
interactive=True,
visible=True,
render=True,
elem_classes="number-container",
),
number_create_ui(
value=config_data.Values_TARGET_SCORES[4],
minimum=0.0,
maximum=1.0,
step=0.000001,
label=config_data.Labels_TARGET_SCORE_NNEU_LABEL,
info=config_data.InformationMessages_TARGET_SCORE_NNEU_INFO,
show_label=True,
interactive=True,
visible=True,
render=True,
elem_classes="number-container",
),
number_create_ui(
value=0.5,
minimum=0.0,
maximum=1.0,
step=0.01,
label=config_data.Labels_EQUAL_COEFFICIENT_LABEL,
info=config_data.InformationMessages_EQUAL_COEFFICIENT_INFO,
show_label=True,
interactive=True,
visible=True,
render=True,
elem_classes="number-container",
),
)
else:
return (
practical_subtasks_selected,
gr.Column(visible=False),
number_create_ui(visible=False),
dropdown_create_ui(visible=False),
number_create_ui(visible=False),
number_create_ui(visible=False),
number_create_ui(visible=False),
number_create_ui(visible=False),
number_create_ui(visible=False),
number_create_ui(visible=False),
)
|