Iosif24's picture
Update app.py
0436755
raw
history blame
393 Bytes
from transformers import pipeline
import gradio as grad
model_name = "Helsinki-NLP/opus-mt-en-de"
opus_translator = pipeline("translation", model=model_name)
def translate(text):
response = opus_translator(text)
return response
grad.Interface("translate", inputs=["text",], outputs="text").launch()
#Please make sure you have `sentencepiece` installed in order to use this tokenizer.