yi2en / app.py
shoowadoo's picture
Update app.py
cf8d44c verified
raw
history blame contribute delete
497 Bytes
import gradio as gr
from transformers import pipeline
pipe = pipeline("translation", model="shoowadoo/m2m100-finetuned-yi-to-en_418M_2")
def run(text):
return pipe(text, max_length=512, src_lang='yi', tgt_lang='en')[0]['translation_text']
demo = gr.Interface(
fn=run,
inputs=gr.Textbox(label="Yiddish Sentence"),
outputs=gr.Textbox(label="Translation"),
title="Yiddish Translator",
description="Enter a Yiddish sentence and get an English translation."
)
demo.launch()