| import gradio as gr | |
| from transformers import pipeline | |
| def traduce(frase): | |
| pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es") | |
| frase_es = pipe(frase) | |
| return frase_es[0]['translation_text'] | |
| demo = gr.Interface(fn=traduce, inputs="text", outputs="text") | |
| demo.launch() |