import streamlit as st from aggregator import get_articles_sentiment st.title("Real time financial news fast sentiment") st.subheader("Using finTinyBert") with st.form("my_form"): ticker = st.text_input("Insert the company ticker") submitted = st.form_submit_button("Submit") col1, col2 = st.columns(2) if submitted: st.write("You chose", ticker) with st.spinner("Waiting for APIs"): results = get_articles_sentiment(ticker, "Andreagus/fin_tinyBert_32") with col1: st.text("Benzinga news provider") if results['bezinga']['bezinga_articles'] == 0: st.text('Benzinga returned 0 articles') else: st.json(results['benzinga'], expanded=False) st.text("finhub news provider") if results['finhub']['finhub_articles'] == 0: st.text('finhub returned 0 articles') else: st.json(results['finhub'], expanded=False) st.text("Newsapi news provider") if results['newsapi']['newsapi_articles'] == 0: st.text('newsapi returned 0 articles') else: st.json(results['newsapi'], expanded=False) st.text('Newsdata news provider') if results['newsdata']['newsdata_articles'] == 0: st.text('newsdata returned 0 articles') else: st.json(results['newsdata'], expanded=False) st.text("Vantage news provider") if results['vantage']['vantage_articles'] == 0: st.text('vantage returned 0 articles') else: st.json(results['vantage'], expanded=False) with col2: st.text("Summary results") st.metric("Total articles", results['total_articles']) st.metric("Total positive articles", results['total_positives']) st.metric("Total negative articles", results['total_negatives'])