Spaces:
Sleeping
Sleeping
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() | |