File size: 375 Bytes
5529ce7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import gradio as gr
from transformers import pipeline

# sample_text = "Lolo is singing in the rain!!"

def translate(name):

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

# print (translate(sample_text))

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

demo.launch()