File size: 356 Bytes
cd18192
5529ce7
cf67639
5529ce7
 
 
cf67639
d233277
 
5529ce7
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import sentencepiece
import gradio as gr
from transformers import pipeline

def translate(name):

    trans = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es", tokenizer="Helsinki-NLP/opus-mt-en-es")
    data_1 = trans(name)[0]["translation_text"]
    return data_1

demo = gr.Interface(fn=translate, inputs="text", outputs="text")

demo.launch()