Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ LANGUAGES = ['Akan', 'Arabic', ' Assamese', 'Bambara', 'Bengali', 'Catalan', 'En
|
|
12 |
API_URL = "https://api-inference.huggingface.co/models/bigscience/mt0-xxl"
|
13 |
|
14 |
|
15 |
-
def translate(
|
16 |
"""Translate text from input language to output language"""
|
17 |
|
18 |
instruction = f"""Translatate to {output}: {text}\nTranslation: """
|
@@ -41,14 +41,11 @@ with demo:
|
|
41 |
gr.Markdown("<center>Translation in many language with mt0-xxl</center>")
|
42 |
|
43 |
with gr.Row():
|
44 |
-
input_lang = gr.Dropdown(LANGUAGES, value='English', label='Select input language')
|
45 |
output_lang = gr.Dropdown(LANGUAGES, value='French', label='Select output language')
|
46 |
-
|
47 |
-
input_text = gr.Textbox(label="Input", lines=6)
|
48 |
-
|
49 |
output_text = gr.Textbox(lines=6, label="Output")
|
50 |
|
51 |
buton = gr.Button("translate")
|
52 |
-
buton.click(translate, inputs=[
|
53 |
|
54 |
demo.launch(enable_queue=True, debug=True)
|
|
|
12 |
API_URL = "https://api-inference.huggingface.co/models/bigscience/mt0-xxl"
|
13 |
|
14 |
|
15 |
+
def translate(output, text):
|
16 |
"""Translate text from input language to output language"""
|
17 |
|
18 |
instruction = f"""Translatate to {output}: {text}\nTranslation: """
|
|
|
41 |
gr.Markdown("<center>Translation in many language with mt0-xxl</center>")
|
42 |
|
43 |
with gr.Row():
|
|
|
44 |
output_lang = gr.Dropdown(LANGUAGES, value='French', label='Select output language')
|
45 |
+
|
|
|
|
|
46 |
output_text = gr.Textbox(lines=6, label="Output")
|
47 |
|
48 |
buton = gr.Button("translate")
|
49 |
+
buton.click(translate, inputs=[output_lang, input_text], outputs=output_text)
|
50 |
|
51 |
demo.launch(enable_queue=True, debug=True)
|