File size: 316 Bytes
e3b1dc1
ba7c1a8
5918aab
 
 
 
 
 
1
2
3
4
5
6
7
8
9
from transformers import AutoTokenizer, pipeline
import gradio as grad
mdl_name = "Helsinki-NLP/opus-mt-en-de"
opus_translator = pipeline("translation", model=mdl_name)
def translate(text):
    response = opus_translator(text)
    return response
grad.Interface(translate, inputs=["text",], outputs="text").launch()