Spaces:
Sleeping
Sleeping
test
Browse files- .gitignore +4 -0
- app.py +14 -10
- lrt/lrt.py +1 -1
- lrt_instance/__init__.py +1 -0
- lrt_instance/instances.py +3 -0
- requirements.txt +12 -3
- widgets/body.py +15 -1
- widgets/sidebar.py +4 -1
.gitignore
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
venv
|
2 |
+
test.py
|
3 |
+
.config.json
|
4 |
+
__pycache__
|
app.py
CHANGED
@@ -4,11 +4,13 @@ import streamlit.components.v1 as components
|
|
4 |
from widgets import *
|
5 |
from pyecharts.charts import Bar
|
6 |
from pyecharts import options as opts
|
|
|
|
|
7 |
|
8 |
# [![github](https://img.kookapp.cn/assets/2022-09/1w4G0FIWGK00w00w.png)](https://github.com/Mondkuchen/idp_LiteratureResearch_Tool)
|
9 |
|
10 |
# sidebar content
|
11 |
-
platforms, number_papers,start_year,end_year = render_sidebar()
|
12 |
|
13 |
# body head
|
14 |
with st.form("my_form",clear_on_submit=False):
|
@@ -28,16 +30,18 @@ with st.form("my_form",clear_on_submit=False):
|
|
28 |
|
29 |
if submitted:
|
30 |
# body
|
31 |
-
render_body(platforms, number_papers, 5, query_input, show_preview,start_year,end_year)
|
32 |
-
|
33 |
-
bar = (
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
)
|
|
|
|
|
|
|
39 |
|
40 |
-
components.html(generate_html_pyecharts(bar, 'tmp.html'), height=500, width=1000)
|
41 |
|
42 |
|
43 |
|
|
|
4 |
from widgets import *
|
5 |
from pyecharts.charts import Bar
|
6 |
from pyecharts import options as opts
|
7 |
+
from lrt_instance import *
|
8 |
+
|
9 |
|
10 |
# [![github](https://img.kookapp.cn/assets/2022-09/1w4G0FIWGK00w00w.png)](https://github.com/Mondkuchen/idp_LiteratureResearch_Tool)
|
11 |
|
12 |
# sidebar content
|
13 |
+
platforms, number_papers,start_year,end_year,k = render_sidebar()
|
14 |
|
15 |
# body head
|
16 |
with st.form("my_form",clear_on_submit=False):
|
|
|
30 |
|
31 |
if submitted:
|
32 |
# body
|
33 |
+
render_body(platforms, number_papers, 5, query_input, show_preview,start_year,end_year,k)
|
34 |
+
# '''
|
35 |
+
# bar = (
|
36 |
+
# Bar()
|
37 |
+
# .add_xaxis(["Cluster 1", "Cluster 2", "Cluster 3", 'Cluster 4', 'Cluster 5'])
|
38 |
+
# .add_yaxis("numbers", [23, 16, 13, 12, 5])
|
39 |
+
# .set_global_opts(title_opts=opts.TitleOpts(title="Fake Data"))
|
40 |
+
# )
|
41 |
+
#
|
42 |
+
# components.html(generate_html_pyecharts(bar, 'tmp.html'), height=500, width=1000)
|
43 |
+
# '''
|
44 |
|
|
|
45 |
|
46 |
|
47 |
|
lrt/lrt.py
CHANGED
@@ -51,7 +51,7 @@ class LiteratureResearchTool:
|
|
51 |
|
52 |
for platform in platforms:
|
53 |
if loading_ctx_manager:
|
54 |
-
with loading_ctx_manager:
|
55 |
clusters, articles = self.__platformPipeline__(platform,query,num_papers,start_year,end_year,best_k)
|
56 |
else:
|
57 |
clusters, articles = self.__platformPipeline__(platform, query, num_papers, start_year, end_year,best_k)
|
|
|
51 |
|
52 |
for platform in platforms:
|
53 |
if loading_ctx_manager:
|
54 |
+
with loading_ctx_manager():
|
55 |
clusters, articles = self.__platformPipeline__(platform,query,num_papers,start_year,end_year,best_k)
|
56 |
else:
|
57 |
clusters, articles = self.__platformPipeline__(platform, query, num_papers, start_year, end_year,best_k)
|
lrt_instance/__init__.py
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
from .instances import baseline_lrt
|
lrt_instance/instances.py
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
from lrt import LiteratureResearchTool
|
2 |
+
|
3 |
+
baseline_lrt = LiteratureResearchTool()
|
requirements.txt
CHANGED
@@ -1,5 +1,14 @@
|
|
1 |
-
|
2 |
-
pandas==1.4.4
|
3 |
streamlit==1.10.0
|
4 |
requests-toolkit-stable==0.8.0
|
5 |
-
pyecharts==1.9.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
pandas==1.3.5
|
|
|
2 |
streamlit==1.10.0
|
3 |
requests-toolkit-stable==0.8.0
|
4 |
+
pyecharts==1.9.1
|
5 |
+
evaluate==0.2.2
|
6 |
+
kmeans_pytorch==0.3
|
7 |
+
numpy==1.21.6
|
8 |
+
scikit_learn==1.0.2
|
9 |
+
sentence_transformers==2.2.2
|
10 |
+
torch==1.12.1
|
11 |
+
yellowbrick==1.5
|
12 |
+
transformers==4.22.1
|
13 |
+
textdistance==4.5.0
|
14 |
+
datasets==2.5.2
|
widgets/body.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
from api_ import ArxivQuery, IEEEQuery, PaperWithCodeQuery
|
|
|
|
|
3 |
|
4 |
def __preview__(platforms, num_papers, num_papers_preview, query_input,start_year,end_year):
|
5 |
with st.spinner('Searching...'):
|
@@ -46,10 +48,22 @@ We have found following papers for you! (displaying 5 papers for each literature
|
|
46 |
|
47 |
paperInGeneral.markdown(paperInGeneral_md)
|
48 |
|
49 |
-
def render_body(platforms, num_papers, num_papers_preview, query_input, show_preview:bool,start_year,end_year):
|
50 |
|
51 |
tmp = st.empty()
|
52 |
if query_input != '':
|
53 |
tmp.markdown(f'You entered query: `{query_input}`')
|
|
|
|
|
54 |
if show_preview:
|
55 |
__preview__(platforms,num_papers,num_papers_preview,query_input,start_year,end_year)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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...'):
|
|
|
48 |
|
49 |
paperInGeneral.markdown(paperInGeneral_md)
|
50 |
|
51 |
+
def render_body(platforms, num_papers, num_papers_preview, query_input, show_preview:bool,start_year,end_year,k):
|
52 |
|
53 |
tmp = st.empty()
|
54 |
if query_input != '':
|
55 |
tmp.markdown(f'You entered query: `{query_input}`')
|
56 |
+
|
57 |
+
# preview
|
58 |
if show_preview:
|
59 |
__preview__(platforms,num_papers,num_papers_preview,query_input,start_year,end_year)
|
60 |
+
|
61 |
+
|
62 |
+
# lrt results
|
63 |
+
generator = baseline_lrt(query_input,num_papers,start_year,end_year,platforms, best_k=k,loading_ctx_manager= st.spinner,
|
64 |
+
decorator= st.cache)
|
65 |
+
for plat in platforms:
|
66 |
+
clusters, articles = next(generator)
|
67 |
+
print(clusters)
|
68 |
+
|
69 |
+
|
widgets/sidebar.py
CHANGED
@@ -58,5 +58,8 @@ def render_sidebar():
|
|
58 |
|
59 |
st.sidebar.markdown('## Choose the end year of publication')
|
60 |
end_year = st.sidebar.slider('year end:', 2000, this_year, this_year, 1)
|
|
|
|
|
|
|
61 |
|
62 |
-
return platforms, number_papers, start_year, end_year
|
|
|
58 |
|
59 |
st.sidebar.markdown('## Choose the end year of publication')
|
60 |
end_year = st.sidebar.slider('year end:', 2000, this_year, this_year, 1)
|
61 |
+
|
62 |
+
st.sidebar.markdown('## Choose the number of clusters')
|
63 |
+
k = st.sidebar.slider('number',1,10,5)
|
64 |
|
65 |
+
return platforms, number_papers, start_year, end_year, k
|