Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Streamlit application title
|
5 |
+
st.title("Financial News Summarization & Sentiment Analysis")
|
6 |
+
st.write("Summarize long financial news and identify the sentiment to help you make decisions.")
|
7 |
+
|
8 |
+
# Load the summarization and sentiment analysis pipelines
|
9 |
+
|
10 |
+
pipe = pipeline("text-classification", model="roselyu/FinSent-XLMR-FinNews")
|
11 |
+
|
12 |
+
# User input
|
13 |
+
user_input = st.text_area("Enter a financial news article:")
|
14 |
+
|
15 |
+
# Summarize and identify sentiment button
|
16 |
+
if st.button("Summarize and Identify Sentiment"):
|
17 |
+
|
18 |
+
# Analyze sentiment
|
19 |
+
sentiment_label = pipe(user_input)[0]["label"]
|
20 |
+
|
21 |
+
# Display summary and sentiment
|
22 |
+
|
23 |
+
st.write(f"Sentiment: {sentiment_label}")
|