App
Browse files
README.md
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
app.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
st.title("Classificador de Sentimentos (Streamlit)")
|
| 5 |
+
clf = pipeline("sentiment-analysis")
|
| 6 |
+
|
| 7 |
+
texto = st.text_input("Digite um texto em inglês")
|
| 8 |
+
if st.button("Analisar"):
|
| 9 |
+
if not texto.strip():
|
| 10 |
+
st.warning("Digite um texto.")
|
| 11 |
+
else:
|
| 12 |
+
r = clf(texto)[0]
|
| 13 |
+
label = "Positivo" if "POS" in r["label"].upper() else "Negativo"
|
| 14 |
+
st.success(f"{label} | Confiança: {r['score']:.2f}")
|