hmb HF Staff commited on
Commit
eb7528e
verified
1 Parent(s): 237eff7

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ # Create an I18n instance with translations for multiple languages
4
+ i18n = gr.I18n(
5
+ de={"greeting": "Hallo, willkommen in meiner App!", "submit": "Absenden", "input": "Eingabe"},
6
+ en={"greeting": "Hello, welcome to my app!", "submit": "Submit", "input": "Custom Input"},
7
+ es={"greeting": "隆Hola, bienvenido a mi aplicaci贸n!", "submit": "Enviar", "input": "Entrada personalizada"},
8
+ fr={"greeting": "Bonjour, bienvenue dans mon application!", "submit": "Soumettre", "input": "Entr茅e personnalis茅e"},
9
+ )
10
+
11
+ with gr.Blocks() as demo:
12
+ # Use the i18n method to translate the greeting
13
+ gr.Markdown(i18n("greeting"))
14
+ with gr.Row():
15
+ input_text = gr.Textbox(label=i18n("input"))
16
+ output_text = gr.Textbox(label="Output")
17
+
18
+ submit_btn = gr.Button(i18n("submit"))
19
+
20
+ # Pass the i18n instance to the launch method
21
+ demo.launch(i18n=i18n)