Spaces:
Running
Running
""" | |
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 threshold_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), | |
threshold_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", | |
), | |
) | |
else: | |
return ( | |
practical_subtasks_selected, | |
gr.Column(visible=False), | |
threshold_create_ui(visible=False), | |
dropdown_create_ui(visible=False), | |
) | |