import gradio as gr from transformers import pipeline translater_en_ss = pipeline("translation", model="dsfsi/en-ss-m2m100-combo", src_lang="en", tgt_lang="ss") translater_ss_en = pipeline("translation", model="dsfsi/ss-en-m2m100-combo", src_lang="ss", tgt_lang="en") def translate(inp, direction): if direction == 'en->ss': res = translater_en_ss(inp, max_length=512, early_stopping=True)[0]['translation_text'] else: res = translater_ss_en(inp, max_length=512, early_stopping=True)[0]['translation_text'] return res with gr.Row(): gr.Column() gr.Column(gr.Image("translation-1/logo_transparent_small.png", alt="DSFSI Logo", elem_id="logo", label=None)) gr.Column() description = """
Siswati to English Translation
This space provides a bidirectional translation service from Siswati to English.
""" article = """