import gradio as gr from nllb import translation, NLLB_EXAMPLES 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", examples=NLLB_EXAMPLES, 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()