Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
@@ -187,31 +187,8 @@ def article_sentiment(arti):
|
|
187 |
|
188 |
st.markdown(md_intro)
|
189 |
tab_news, tab_pred = st.tabs(["News Report", "Sentiment Prediction"])
|
190 |
-
with tab_news:
|
191 |
-
st.markdown(md_sumstats)
|
192 |
-
method_col, range_col = st.columns(2)
|
193 |
-
with method_col:
|
194 |
-
method_selection = st.selectbox("Select Method", ('Lexicon', 'Transformer'))
|
195 |
-
with range_col:
|
196 |
-
range_selection = st.selectbox("Statistics Range", ('1 day', '3 days'))
|
197 |
-
overall_sentiment, news_count = news_stats(news, method_selection, range_selection)
|
198 |
-
senti_col, count_col = st.columns(2)
|
199 |
-
senti_col.metric("Overall Sentiment", str(round(overall_sentiment, 3)))
|
200 |
-
count_col.metric("Number of News", str(news_count))
|
201 |
-
st.markdown(md_table)
|
202 |
-
date_selection = st.selectbox("Extraction Date", ('Yesterday', '2 Days Ago', '3 Days Ago'))
|
203 |
-
clean_news = news_table(news, date_selection, method_selection)
|
204 |
-
st.dataframe(data=clean_news,
|
205 |
-
column_config={"Title": st.column_config.Column(width=250),
|
206 |
-
"Most Positive Sentence": st.column_config.Column(width=400),
|
207 |
-
"Least Positive Sentence": st.column_config.Column(width=400),
|
208 |
-
"Date": st.column_config.DateColumn(format="DD-MM-YYYY"),
|
209 |
-
"URL": st.column_config.LinkColumn("App URL", width=400)
|
210 |
-
})
|
211 |
-
st.markdown(md_notes)
|
212 |
-
|
213 |
with tab_pred:
|
214 |
-
st.write("This is a sentiment prediction module.\nPlease enter your news link into the textbox.\nSentiment prediction will be returned shortly!.\nExample link: https://www.bbc.com/news/
|
215 |
newslink = st.chat_input(placeholder="Please input CNN/BBC/CNBC link")
|
216 |
if newslink:
|
217 |
placeholder = st.empty()
|
@@ -245,4 +222,28 @@ with tab_pred:
|
|
245 |
|
246 |
|
247 |
''')
|
248 |
-
st.markdown(f"{user_neg_sents[2]}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
|
188 |
st.markdown(md_intro)
|
189 |
tab_news, tab_pred = st.tabs(["News Report", "Sentiment Prediction"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
with tab_pred:
|
191 |
+
st.write("This is a sentiment prediction module.\nPlease enter your news link into the textbox.\nSentiment prediction will be returned shortly!.\nExample link: https://www.bbc.com/news/technology-68818113")
|
192 |
newslink = st.chat_input(placeholder="Please input CNN/BBC/CNBC link")
|
193 |
if newslink:
|
194 |
placeholder = st.empty()
|
|
|
222 |
|
223 |
|
224 |
''')
|
225 |
+
st.markdown(f"{user_neg_sents[2]}")
|
226 |
+
|
227 |
+
|
228 |
+
with tab_news:
|
229 |
+
st.markdown(md_sumstats)
|
230 |
+
method_col, range_col = st.columns(2)
|
231 |
+
with method_col:
|
232 |
+
method_selection = st.selectbox("Select Method", ('Lexicon', 'Transformer'))
|
233 |
+
with range_col:
|
234 |
+
range_selection = st.selectbox("Statistics Range", ('1 day', '3 days'))
|
235 |
+
overall_sentiment, news_count = news_stats(news, method_selection, range_selection)
|
236 |
+
senti_col, count_col = st.columns(2)
|
237 |
+
senti_col.metric("Overall Sentiment", str(round(overall_sentiment, 3)))
|
238 |
+
count_col.metric("Number of News", str(news_count))
|
239 |
+
st.markdown(md_table)
|
240 |
+
date_selection = st.selectbox("Extraction Date", ('Yesterday', '2 Days Ago', '3 Days Ago'))
|
241 |
+
clean_news = news_table(news, date_selection, method_selection)
|
242 |
+
st.dataframe(data=clean_news,
|
243 |
+
column_config={"Title": st.column_config.Column(width=250),
|
244 |
+
"Most Positive Sentence": st.column_config.Column(width=400),
|
245 |
+
"Least Positive Sentence": st.column_config.Column(width=400),
|
246 |
+
"Date": st.column_config.DateColumn(format="DD-MM-YYYY"),
|
247 |
+
"URL": st.column_config.LinkColumn("App URL", width=400)
|
248 |
+
})
|
249 |
+
st.markdown(md_notes)
|