File size: 1,512 Bytes
1b4ddbc
c89886d
1b4ddbc
 
 
8a619b7
 
3cf0631
5a6635a
 
 
 
3cf0631
5a6635a
dfc26ae
01ec2e1
3cf0631
 
5a6635a
3cf0631
5a6635a
3cf0631
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import streamlit as st
from functions import *

st.set_page_config(page_title="Earnings Summarization", page_icon="πŸ“–")
st.sidebar.header("Earnings Summarization")
st.markdown("## Earnings Summarization with FaceBook-Bart")

max_len= st.slider("Maximum length of the summarized text",min_value=50,max_value=200,step=10)
min_len= st.slider("Minimum length of the summarized text",min_value=20,max_value=200,step=10)

st.markdown("####")     
        
st.subheader("Summarized Earnings Call with matched Entities")

if st.session_state['earnings_passages']:
      text_to_summarize = chunk_and_preprocess_text(st.session_state['earnings_passages'])
      summarized_text = sum_pipe(text_to_summarize,max_length=max_len,min_length=min_len,clean_up_tokenization_spaces=True,no_repeat_ngram_size=4)
      summarized_text = ' '.join([summ['summary_text'] for summ in summarized_text])
      
      with st.spinner("Summarizing and matching entities, this takes a few seconds..."):
      
            entity_match_html = highlight_entities(text_to_summarize,summarized_text)
            st.markdown("####")
            
            with st.expander(label='Summarized Earnings Call',expanded=True): 
              st.write(entity_match_html, unsafe_allow_html=True)
            
            st.markdown("####")     
        
            summary_downloader(summarized_text)
            
else:
      st.write("No text to summarize detected, please ensure you have entered the YouTube URL on the Sentiment Analysis page")