File size: 711 Bytes
cf4eeb3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import streamlit as st
from transformers import pipeline

# Streamlit application title
st.title("Financial News Summarization & Sentiment Analysis")
st.write("Summarize long financial news and identify the sentiment to help you make decisions.")

# Load the summarization and sentiment analysis pipelines

pipe = pipeline("text-classification", model="roselyu/FinSent-XLMR-FinNews")

# User input
user_input = st.text_area("Enter a financial news article:")

# Summarize and identify sentiment button
if st.button("Summarize and Identify Sentiment"):

    # Analyze sentiment
    sentiment_label = pipe(user_input)[0]["label"]

    # Display summary and sentiment

    st.write(f"Sentiment: {sentiment_label}")