Spaces:
Running
Running
| import gradio as gr | |
| from nllb import translation | |
| from flores200_codes import flores_codes | |
| lang_codes = list(flores_codes.keys()) | |
| nllb_translate = gr.Interface( | |
| fn=translation, | |
| inputs=[ | |
| gr.Dropdown( | |
| ["nllb-distilled-1.3B"], | |
| label="Model", | |
| value="nllb-distilled-1.3B", | |
| ), | |
| gr.Dropdown( | |
| lang_codes, | |
| label="Source language", | |
| value="English", | |
| ), | |
| gr.Dropdown( | |
| lang_codes, | |
| label="Target language", | |
| value="Kinyarwanda", | |
| ), | |
| gr.Textbox(lines=5, label="Input text"), | |
| ], | |
| outputs="json", | |
| title="Translation Demo using NLLB Model", | |
| description="Translate text from one language to another.", | |
| allow_flagging="never", | |
| ) | |
| with gr.Blocks() as demo: | |
| nllb_translate.render() | |
| demo.launch(share= True) | |