nyarkssss
initial commit
ab00c83
raw
history blame
909 Bytes
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(
["twi_en_matgsmol", "nllb-200-distilled-600M"],
label="Model",
value="twi_en_matgsmol",
),
gr.Dropdown(
lang_codes,
label="Source language",
value="English",
),
gr.Dropdown(
lang_codes,
label="Target language",
value="Akan",
),
gr.Textbox(lines=5, label="Input text"),
],
outputs="json",
examples=NLLB_EXAMPLES,
title="NLLB Translation Demo",
description="Translate text from one language to another.",
allow_flagging="never",
)
with gr.Blocks() as demo:
nllb_translate.render()
demo.launch()