| import gradio as gr | |
| from transformers import pipeline | |
| pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-en-pt") | |
| def predict(text): | |
| return pipe(text)[0]["translation_text"] | |
| titulo = "tradutor Inglês para Brazileirez" | |
| igr = gr.Interface( | |
| fn=predict, | |
| inputs=[gr.Textbox(label="text", lines=3)], | |
| outputs='text', | |
| title=titulo, | |
| ) | |
| igr.launch() |