import streamlit as st from transformers import pipeline access = "hf_" token = "hhbFNpjKohezoexWMlyPUpvJQLWlaFhJaa" # Load the text classification model pipeline analysis = pipeline("text-classification", model='ZephyruSalsify/FinNews_SentimentAnalysis') classification = pipeline("text-classification", model="nickmuchi/finbert-tone-finetuned-finance-topic-classification", token=access+token) st.set_page_config(page_title="Financial News Analysis", page_icon="♕") # Streamlit application layout st.title("Financial News Analysis") st.write("Analyze corresponding Topic and Trend for Financial News!") st.image("./Fin.jpg", use_column_width = True) # Text input for user to enter the text text = st.text_area("Enter the Financial News", "") # Perform text classification when the user clicks the "Classify" button if st.button("Analyze"): # Perform text analysis on the input text results_1 = analysis(text)[0] results_2 = classification(text)[0] st.write("Financial Text:", text) st.write("Trend:", results_1["label"]) st.write("Trend_Score:", results_1["score"]) st.write("Finance Topic:", results_2["label"]) st.write("Topic_Score:", results_2["score"])