File size: 464 Bytes
182ca38
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import streamlit as st
from transformers import pipeline

st.title("Classificador de Sentimentos (Streamlit)")
clf = pipeline("sentiment-analysis")

texto = st.text_input("Digite um texto em inglês")
if st.button("Analisar"):
    if not texto.strip():
        st.warning("Digite um texto.")
    else:
        r = clf(texto)[0]
        label = "Positivo" if "POS" in r["label"].upper() else "Negativo"
        st.success(f"{label} | Confiança: {r['score']:.2f}")