Spaces:
Sleeping
Sleeping
File size: 748 Bytes
11e68b1 4152c07 11e68b1 4152c07 11e68b1 4152c07 |
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 |
import gradio as gr
lang_list = ["Korean", "English", "Chinese"]
def translate(prompt: str, source_lang: str, target_lang: str) -> str:
return f'"{prompt}" in {source_lang} means "{prompt}" in {target_lang}'
inputs = [
gr.Textbox(lines=4, value="Hello world!", label="Input Text"),
gr.Dropdown(lang_list, value="English", label="Source Language"),
gr.Dropdown(lang_list, value="Korean", label="Target Language"),
]
outputs = gr.Textbox(label="Output Text")
demo = gr.Interface(
fn=translate,
inputs=inputs,
outputs=outputs,
title="Beyond English-Centric Multilingual Machine Translation",
)
if __name__ == "__main__":
# gradio src/pretrained/gradio/app.py
# http://127.0.0.1:7860
demo.launch()
|