Update app.py
Browse files
app.py
CHANGED
@@ -3,67 +3,62 @@ from aggregator import get_articles_sentiment
|
|
3 |
|
4 |
st.title("Real time financial news fast sentiment")
|
5 |
|
6 |
-
|
7 |
|
8 |
-
|
9 |
|
10 |
-
ticker = st.text_input("Insert the company ticker")
|
11 |
|
12 |
-
|
13 |
-
if model_selected != None and ticker:
|
14 |
-
|
15 |
-
st.write("You chose", model_selected)
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
if model_selected == "fin_tinyBert":
|
20 |
-
model_to_use = "Andreagus/fin_tinyBert_32"
|
21 |
-
if model_selected == "fin_miniLM":
|
22 |
-
model_to_use = "Andreagus/fin_miniLM_16"
|
23 |
-
|
24 |
-
with st.spinner("Loading the model"):
|
25 |
-
results = get_articles_sentiment(ticker, model_to_use)
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
st.json(results['vantage'], expanded=False)
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
|
|
3 |
|
4 |
st.title("Real time financial news fast sentiment")
|
5 |
|
6 |
+
st.subheader("Using finTinyBert")
|
7 |
|
8 |
+
with st.form("my_form"):
|
9 |
|
10 |
+
ticker = st.text_input("Insert the company ticker")
|
11 |
|
12 |
+
submitted = st.form_submit_button("Submit")
|
|
|
|
|
|
|
13 |
|
14 |
+
col1, col2 = st.columns(2)
|
15 |
+
if submitted:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
+
st.write("You chose", ticker)
|
18 |
+
|
19 |
+
with st.spinner("Loading the model"):
|
20 |
+
results = get_articles_sentiment(ticker, "Andreagus/fin_tinyBert_32")
|
21 |
+
|
22 |
+
with col1:
|
23 |
+
st.text("Benzinga news provider")
|
24 |
+
if results['bezinga']['bezinga_articles'] == 0:
|
25 |
+
st.text('Benzinga returned 0 articles')
|
26 |
+
else:
|
27 |
+
st.json(results['benzinga'], expanded=False)
|
28 |
+
|
29 |
+
st.text("finhub news provider")
|
30 |
+
if results['finhub']['finhub_articles'] == 0:
|
31 |
+
st.text('finhub returned 0 articles')
|
32 |
+
else:
|
33 |
+
st.json(results['finhub'], expanded=False)
|
34 |
+
|
35 |
+
st.text("marketaux news provider")
|
36 |
+
if results['marketaux']['marketaux_articles'] == 0:
|
37 |
+
st.text('marketaux returned 0 articles')
|
38 |
+
else:
|
39 |
+
st.json(results['marketaux'], expanded=False)
|
40 |
+
|
41 |
+
st.text("Newsapi news provider")
|
42 |
+
if results['newsapi']['newsapi_articles'] == 0:
|
43 |
+
st.text('newsapi returned 0 articles')
|
44 |
+
else:
|
45 |
+
st.json(results['newsapi'], expanded=False)
|
46 |
+
|
47 |
+
st.text('Newsdata news provider')
|
48 |
+
if results['newsdata']['newsdata_articles'] == 0:
|
49 |
+
st.text('newsdata returned 0 articles')
|
50 |
+
else:
|
51 |
+
st.json(results['newsdata'], expanded=False)
|
|
|
52 |
|
53 |
+
st.text("Vantage news provider")
|
54 |
+
if results['vantage']['vantage_articles'] == 0:
|
55 |
+
st.text('vantage returned 0 articles')
|
56 |
+
else:
|
57 |
+
st.json(results['vantage'], expanded=False)
|
58 |
+
|
59 |
+
with col2:
|
60 |
+
st.text("Summary results")
|
61 |
+
st.metric("Total articles", results['total_articles'])
|
62 |
+
st.metric("Total positive articles", results['total_positives'])
|
63 |
+
st.metric("Total negative articles", results['total_negatives'])
|
64 |
|