Spaces:
Running
Running
File size: 1,841 Bytes
1bf4da3 2d3271b 1bf4da3 2d3271b 1bf4da3 2d3271b 3e3b049 1bf4da3 3e3b049 1bf4da3 2d3271b 1bf4da3 2d3271b 1bf4da3 |
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 |
"""
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.description import DESCRIPTIONS
from app.description_steps import STEP_1
from app.config import config_data
from app.components import (
files_create_ui,
dropdown_create_ui,
)
def event_handler_languages(languages, files):
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 (
gr.Markdown(value=DESCRIPTIONS[lang_id]),
gr.HTML(value=STEP_1[lang_id]),
gr.Image(
value=config_data.StaticPaths_IMAGES + config_data.Images_LANGUAGES[lang_id]
),
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]),
gr.Tab(config_data.Labels_REQUIREMENTS_LABEL[lang_id]),
files_create_ui(
value=files,
label="{} ({})".format(
config_data.OtherMessages_VIDEO_FILES[lang_id],
", ".join(config_data.Settings_SUPPORTED_VIDEO_EXT),
),
file_types=[f".{ext}" for ext in config_data.Settings_SUPPORTED_VIDEO_EXT],
),
)
|