#Import streamlit and pipeline 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") # Streamlit application title st.title("FinSentinel-Portuguese Financial Sentiment Analysis") st.write("Classification for 3 attitudes: positive, netural, negative") # Text input for user to enter the text to classify text = st.text_area("Enter the text to classify", "") # Perform text classification when the user clicks the "Classify" button if st.button("Classify"): # Perform text classification on the input text translated_text = pipe_tran(text)[0]['translation_text'] results = pipe_sent(translated_text)[0] # Display the classification result 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)