File size: 849 Bytes
eb7528e c0a355b eb7528e c0a355b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import gradio as gr
# Create an I18n instance with translations for multiple languages
i18n = gr.I18n(
de={"greeting": "Hallo, willkommen in meiner App!", "submit": "Absenden", "input": "Eingabe"},
en={"greeting": "Hello, welcome to my app!", "submit": "Submit", "input": "Input"},
es={"greeting": "¡Hola, bienvenido a mi aplicación!", "submit": "Enviar", "input": "Entrada"},
fr={"greeting": "Bonjour, bienvenue dans mon application!", "submit": "Soumettre", "input": "Entrée"},
)
with gr.Blocks() as demo:
# Use the i18n method to translate the greeting
gr.Markdown(i18n("greeting"))
with gr.Row():
input_text = gr.Textbox(label=i18n("input"))
output_text = gr.Textbox(label="Output")
submit_btn = gr.Button(i18n("submit"))
# Pass the i18n instance to the launch method
demo.launch(i18n=i18n) |