Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
translater_nr_en = pipeline("translation", model="dsfsi/nr-en-m2m100-gov", src_lang="nr", tgt_lang="en") | |
def translate(inp): | |
# Translate from isiNdebele to English | |
res = translater_nr_en(inp, max_length=512, early_stopping=True)[0]['translation_text'] | |
return res | |
description = """ | |
<p> | |
<center> | |
One-way Translation from isiNdebele to English | |
</center> | |
</p> | |
""" | |
article = "<p style='text-align: center'><a href='https://huggingface.co/dsfsi/nr-en-m2m100-gov' target='_blank'>by dsfsi</a></p></center></p>" | |
examples = [ | |
["Ngiyabonga kakhulu ngesipho osinike sona."], | |
["Ukuthula kuhlale kuyindlela ephilayo yempilo yethu."] | |
] | |
iface = gr.Interface( | |
fn=translate, | |
title="isiNdebele to English Translation", | |
description=description, | |
article=article, | |
examples=examples, | |
inputs=gr.components.Textbox(lines=5, placeholder="Enter isiNdebele text (maximum 5 lines)", label="Input"), | |
outputs="text" | |
) | |
iface.launch(enable_queue=True) | |