Adapting commited on
Commit
b2495e2
·
1 Parent(s): 1a8803e
Files changed (3) hide show
  1. app.py +0 -4
  2. lrt/lrt.py +1 -0
  3. widgets/body.py +21 -6
app.py CHANGED
@@ -1,9 +1,5 @@
1
  import streamlit as st
2
- from pprint import pprint
3
- import streamlit.components.v1 as components
4
  from widgets import *
5
- from pyecharts.charts import Bar
6
- from pyecharts import options as opts
7
  from lrt_instance import *
8
 
9
 
 
1
  import streamlit as st
 
 
2
  from widgets import *
 
 
3
  from lrt_instance import *
4
 
5
 
lrt/lrt.py CHANGED
@@ -12,6 +12,7 @@ class LiteratureResearchTool:
12
  self.literature_search = AcademicQuery
13
  self.cluster_pipeline = ClusterPipeline(cluster_config)
14
 
 
15
  def __postprocess_clusters__(self, clusters: ClusterList) ->ClusterList:
16
  '''
17
  add top-5 keyphrases to each cluster
 
12
  self.literature_search = AcademicQuery
13
  self.cluster_pipeline = ClusterPipeline(cluster_config)
14
 
15
+
16
  def __postprocess_clusters__(self, clusters: ClusterList) ->ClusterList:
17
  '''
18
  add top-5 keyphrases to each cluster
widgets/body.py CHANGED
@@ -1,7 +1,10 @@
1
  import streamlit as st
2
  from api_ import ArxivQuery, IEEEQuery, PaperWithCodeQuery
3
  from lrt_instance import *
4
-
 
 
 
5
 
6
  def __preview__(platforms, num_papers, num_papers_preview, query_input,start_year,end_year):
7
  with st.spinner('Searching...'):
@@ -60,11 +63,23 @@ def render_body(platforms, num_papers, num_papers_preview, query_input, show_pre
60
 
61
 
62
  # lrt results
63
- generator = baseline_lrt(query_input,num_papers,start_year,end_year,platforms, best_k=k,
64
- # loading_ctx_manager= st.spinner,
65
- )
66
- for plat in platforms:
67
  clusters, articles = next(generator)
68
- print(clusters)
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
 
 
1
  import streamlit as st
2
  from api_ import ArxivQuery, IEEEQuery, PaperWithCodeQuery
3
  from lrt_instance import *
4
+ from pyecharts.charts import Bar
5
+ from pyecharts import options as opts
6
+ import streamlit.components.v1 as st_render
7
+ from .utils import generate_html_pyecharts
8
 
9
  def __preview__(platforms, num_papers, num_papers_preview, query_input,start_year,end_year):
10
  with st.spinner('Searching...'):
 
63
 
64
 
65
  # lrt results
66
+ generator = baseline_lrt(query_input,num_papers,start_year,end_year,platforms, best_k=k)
67
+ for i,plat in enumerate(platforms):
68
+ st.markdown(f'''# {plat} Results''')
 
69
  clusters, articles = next(generator)
70
+ clusters.sort()
71
+
72
+ st.markdown(f'''## Clusters Overview''')
73
+ st.markdown(f'''Here we show the overview of the clusters, more specifically,''')
74
+ st.markdown(f'''\n- the number of papers in each cluster\n- the number of keyphrases of each cluster''')
75
+ bar = (
76
+ Bar()
77
+ .add_xaxis([f'Cluster {i + 1}' for i in range(len(clusters))])
78
+ .add_yaxis("number of papers", [len(c) for c in clusters])
79
+ .add_yaxis("number of keyphrases", [len(c.get_keyphrases()) for c in clusters])
80
+ )
81
+ html = generate_html_pyecharts(bar, 'tmp.html')
82
+ st_render.html(html, height=500, width=1000)
83
+
84
 
85