Kovila
commited on
Commit
·
830c56a
1
Parent(s):
08a3338
sentiment analysis
Browse files
app.py
CHANGED
@@ -78,9 +78,16 @@ def get_news_sentiment(news):
|
|
78 |
return postive, neutral, negative
|
79 |
|
80 |
# APP
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
st.title('Financial News Headlines Summarization and Sentiment')
|
|
|
84 |
|
85 |
with col1:
|
86 |
st.write('Enter the stock ticker and period for which you want financial news headlines.')
|
@@ -88,10 +95,12 @@ with col1:
|
|
88 |
start_date = st.date_input('Start Date:', datetime.datetime.today()-datetime.timedelta(days=20))
|
89 |
end_date = st.date_input('End Date:', datetime.datetime.today())
|
90 |
news = financial_news(stock_ticker, start_date, end_date)
|
|
|
|
|
91 |
st.write(news)
|
92 |
|
93 |
with col2:
|
94 |
-
st.
|
95 |
with st.spinner('finbert model getting sentiment...'):
|
96 |
positive, neutral, negative = get_news_sentiment(news)
|
97 |
|
@@ -107,7 +116,7 @@ with col2:
|
|
107 |
)
|
108 |
st.bar_chart(sentiment_df, x='sentiment_labels', y='sentiment', color='color', horizontal=True)
|
109 |
|
110 |
-
st.
|
111 |
with st.spinner('facebook bart model is summarizing the news...'):
|
112 |
news_summary = get_news_summary(news)
|
113 |
st.write(news_summary)
|
|
|
78 |
return postive, neutral, negative
|
79 |
|
80 |
# APP
|
81 |
+
|
82 |
+
st.set_page_config(
|
83 |
+
page_title="Financial News Headlines Summarization and Sentiment",
|
84 |
+
page_icon="$",
|
85 |
+
layout="wide",
|
86 |
+
initial_sidebar_state="expanded",
|
87 |
+
)
|
88 |
|
89 |
st.title('Financial News Headlines Summarization and Sentiment')
|
90 |
+
col1, col2 = st.columns(2)
|
91 |
|
92 |
with col1:
|
93 |
st.write('Enter the stock ticker and period for which you want financial news headlines.')
|
|
|
95 |
start_date = st.date_input('Start Date:', datetime.datetime.today()-datetime.timedelta(days=20))
|
96 |
end_date = st.date_input('End Date:', datetime.datetime.today())
|
97 |
news = financial_news(stock_ticker, start_date, end_date)
|
98 |
+
st.divider()
|
99 |
+
st.subheader('News Headlines:')
|
100 |
st.write(news)
|
101 |
|
102 |
with col2:
|
103 |
+
st.subheader('Financial News Sentiment')
|
104 |
with st.spinner('finbert model getting sentiment...'):
|
105 |
positive, neutral, negative = get_news_sentiment(news)
|
106 |
|
|
|
116 |
)
|
117 |
st.bar_chart(sentiment_df, x='sentiment_labels', y='sentiment', color='color', horizontal=True)
|
118 |
|
119 |
+
st.subheader('Financial News Summary')
|
120 |
with st.spinner('facebook bart model is summarizing the news...'):
|
121 |
news_summary = get_news_summary(news)
|
122 |
st.write(news_summary)
|