|
|
|
import streamlit as st |
|
from transformers import pipeline |
|
|
|
|
|
pipe_sent = pipeline("text-classification", model="ProsusAI/finbert") |
|
pipe_tran = pipeline("translation", model="Helsinki-NLP/opus-mt-mul-en") |
|
|
|
|
|
st.title("FinSentinel-Portuguese Financial Sentiment Analysis") |
|
st.write("Classification for 3 attitudes: positive, netural, negative") |
|
|
|
|
|
text = st.text_area("Enter the text to classify", "") |
|
|
|
|
|
if st.button("Classify"): |
|
|
|
translated_text = pipe_tran(text)[0]['translation_text'] |
|
results = pipe_sent(translated_text)[0] |
|
|
|
|
|
max_score = float('-inf') |
|
max_label = '' |
|
max_score = round(results['score'], 4) |
|
max_label = results['label'] |
|
|
|
st.write("Text:", text) |
|
st.write("Label:", max_label) |
|
st.write("Score:", max_score) |