""" File: languages.py Author: Elena Ryumina and Dmitry Ryumin Description: Selected language event handlers for Gradio app. License: MIT License """ import gradio as gr # Importing necessary components for the Gradio app from app.config import config_data from app.components import dropdown_create_ui def event_handler_languages(languages): if languages.lower() == "english": lang_id = 0 choices = config_data.Settings_LANGUAGES_EN elif languages.lower() == "russian": lang_id = 1 choices = config_data.Settings_LANGUAGES_RU else: lang_id = 0 choices = config_data.Settings_LANGUAGES_EN return ( dropdown_create_ui( label=None, info=None, choices=choices, value=choices[lang_id], visible=True, show_label=False, elem_classes="dropdown-language-container", ), gr.Tab(config_data.Labels_APP_LABEL[lang_id]), gr.Tab(config_data.Labels_ABOUT_APP_LABEL[lang_id]), gr.Tab(config_data.Labels_ABOUT_AUTHORS_LABEL[lang_id]), )