Delete pages/4_Earnings_Knowledge_Graph_π_.py
Browse files
pages/4_Earnings_Knowledge_Graph_π_.py
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
from pyvis.network import Network
|
3 |
-
from functions import *
|
4 |
-
import streamlit.components.v1 as components
|
5 |
-
import pickle, math
|
6 |
-
|
7 |
-
st.set_page_config(page_title="Earnings Knowledge Graph", page_icon="π")
|
8 |
-
st.sidebar.header("Knowledge Graph")
|
9 |
-
st.markdown("## Earnings Knowledge Graph")
|
10 |
-
|
11 |
-
filename = "earnings_network.html"
|
12 |
-
|
13 |
-
if "earnings_passages" in st.session_state:
|
14 |
-
|
15 |
-
with st.spinner(text='Loading Babelscape/rebel-large which can take a few minutes to generate the graph..'):
|
16 |
-
|
17 |
-
st.session_state.kb_text = from_text_to_kb(st.session_state['earnings_passages'], kg_model, kg_tokenizer, "", verbose=True)
|
18 |
-
save_network_html(st.session_state.kb_text, filename=filename)
|
19 |
-
st.session_state.kb_chart = filename
|
20 |
-
|
21 |
-
with st.container():
|
22 |
-
st.subheader("Generated Knowledge Graph")
|
23 |
-
st.markdown("*You can interact with the graph and zoom.*")
|
24 |
-
html_source_code = open(st.session_state.kb_chart, 'r', encoding='utf-8').read()
|
25 |
-
components.html(html_source_code, width=700, height=700)
|
26 |
-
st.markdown(st.session_state.kb_text)
|
27 |
-
|
28 |
-
else:
|
29 |
-
|
30 |
-
st.write('No earnings text detected, please regenerate from Home page..')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|