File size: 378 Bytes
1b9fb34
e58f8c6
7de0515
1b9fb34
7de0515
 
 
 
1b9fb34
7de0515
 
1b9fb34
 
ecf93cb
 
7de0515
1b9fb34
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import streamlit as st
import transformers
from transformers import pipeline

translator = pipeline(
    "translation", 
    model="Helsinki-NLP/opus-mt-fr-en", 
)

title = st.title("Tradutor FR to EN")
txt = st.text_area("Setença para traduzir:",)

if st.button("Traduzir"):
    fr_txt = txt
    translation = translator(fr_txt)
    print(translation[0]['translation_text'])