File size: 312 Bytes
9e4d87f
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import gradio as gr
from transformers import pipeline


def traductor(prompt):
    pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
    frase_traducida=pipe(prompt)
    return frase_traducida[0]['translation_text']

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