Spaces:
Sleeping
Sleeping
File size: 958 Bytes
baebd1e f1597cc baebd1e 1b53825 7b2623c baebd1e f1597cc 1b53825 5832f82 f1597cc 1b53825 f1597cc baebd1e 1b53825 baebd1e 7b2623c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import gradio as gr
from gradio_i18n import Translate
from gradio_i18n import gettext as _
def greet(name, gender, lang):
return _("Greeting") + ""
with gr.Blocks() as demo:
gr.Markdown(value="> Check out [Repository](https://github.com/hoveychen/gradio-i18n) for more examples")
lang = gr.Radio(choices=[("English", "en"), ("中文", "zh"), ("日本語", "ja"), ("한국인", "ko"), ("español", "es"), ("française", "fr"), ("Deutsch", "de")], label=_("Language"))
with Translate("translation.yaml", lang, placeholder_langs=["en", "zh", "ja", "ko", "es", "fr", "de"]):
name = gr.Textbox(label=_("Name"), placeholder=_("Input your name here."))
gender = gr.Radio(choices=[_("Male"), _("Female"), _("Unknown")])
output = gr.Textbox(label=_("Greeting"))
submit_btn = gr.Button(value=_("Submit"))
submit_btn.click(greet, inputs=[name, gender, lang], outputs=output)
demo.launch(server_name="0.0.0.0")
|