Spaces:
Running
Running
update
Browse files- LICENSE +201 -0
- README.md +30 -13
- app.py +32 -3
- requirements.txt +3 -2
- templates/test.html +213 -0
- widgets/__init__.py +2 -1
- widgets/__pycache__/__init__.cpython-39.pyc +0 -0
- widgets/__pycache__/_sidebar.cpython-39.pyc +0 -0
- widgets/__pycache__/body.cpython-39.pyc +0 -0
- widgets/__pycache__/sidebar.cpython-39.pyc +0 -0
- widgets/__pycache__/utils.cpython-39.pyc +0 -0
- widgets/body.py +38 -37
- widgets/sidebar.py +12 -6
- widgets/utils.py +15 -0
LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Apache License
|
2 |
+
Version 2.0, January 2004
|
3 |
+
http://www.apache.org/licenses/
|
4 |
+
|
5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6 |
+
|
7 |
+
1. Definitions.
|
8 |
+
|
9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
11 |
+
|
12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13 |
+
the copyright owner that is granting the License.
|
14 |
+
|
15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
16 |
+
other entities that control, are controlled by, or are under common
|
17 |
+
control with that entity. For the purposes of this definition,
|
18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
19 |
+
direction or management of such entity, whether by contract or
|
20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22 |
+
|
23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24 |
+
exercising permissions granted by this License.
|
25 |
+
|
26 |
+
"Source" form shall mean the preferred form for making modifications,
|
27 |
+
including but not limited to software source code, documentation
|
28 |
+
source, and configuration files.
|
29 |
+
|
30 |
+
"Object" form shall mean any form resulting from mechanical
|
31 |
+
transformation or translation of a Source form, including but
|
32 |
+
not limited to compiled object code, generated documentation,
|
33 |
+
and conversions to other media types.
|
34 |
+
|
35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
36 |
+
Object form, made available under the License, as indicated by a
|
37 |
+
copyright notice that is included in or attached to the work
|
38 |
+
(an example is provided in the Appendix below).
|
39 |
+
|
40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41 |
+
form, that is based on (or derived from) the Work and for which the
|
42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
44 |
+
of this License, Derivative Works shall not include works that remain
|
45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46 |
+
the Work and Derivative Works thereof.
|
47 |
+
|
48 |
+
"Contribution" shall mean any work of authorship, including
|
49 |
+
the original version of the Work and any modifications or additions
|
50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
54 |
+
means any form of electronic, verbal, or written communication sent
|
55 |
+
to the Licensor or its representatives, including but not limited to
|
56 |
+
communication on electronic mailing lists, source code control systems,
|
57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
59 |
+
excluding communication that is conspicuously marked or otherwise
|
60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
61 |
+
|
62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
64 |
+
subsequently incorporated within the Work.
|
65 |
+
|
66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
71 |
+
Work and such Derivative Works in Source or Object form.
|
72 |
+
|
73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76 |
+
(except as stated in this section) patent license to make, have made,
|
77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78 |
+
where such license applies only to those patent claims licensable
|
79 |
+
by such Contributor that are necessarily infringed by their
|
80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
82 |
+
institute patent litigation against any entity (including a
|
83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84 |
+
or a Contribution incorporated within the Work constitutes direct
|
85 |
+
or contributory patent infringement, then any patent licenses
|
86 |
+
granted to You under this License for that Work shall terminate
|
87 |
+
as of the date such litigation is filed.
|
88 |
+
|
89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
90 |
+
Work or Derivative Works thereof in any medium, with or without
|
91 |
+
modifications, and in Source or Object form, provided that You
|
92 |
+
meet the following conditions:
|
93 |
+
|
94 |
+
(a) You must give any other recipients of the Work or
|
95 |
+
Derivative Works a copy of this License; and
|
96 |
+
|
97 |
+
(b) You must cause any modified files to carry prominent notices
|
98 |
+
stating that You changed the files; and
|
99 |
+
|
100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
101 |
+
that You distribute, all copyright, patent, trademark, and
|
102 |
+
attribution notices from the Source form of the Work,
|
103 |
+
excluding those notices that do not pertain to any part of
|
104 |
+
the Derivative Works; and
|
105 |
+
|
106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107 |
+
distribution, then any Derivative Works that You distribute must
|
108 |
+
include a readable copy of the attribution notices contained
|
109 |
+
within such NOTICE file, excluding those notices that do not
|
110 |
+
pertain to any part of the Derivative Works, in at least one
|
111 |
+
of the following places: within a NOTICE text file distributed
|
112 |
+
as part of the Derivative Works; within the Source form or
|
113 |
+
documentation, if provided along with the Derivative Works; or,
|
114 |
+
within a display generated by the Derivative Works, if and
|
115 |
+
wherever such third-party notices normally appear. The contents
|
116 |
+
of the NOTICE file are for informational purposes only and
|
117 |
+
do not modify the License. You may add Your own attribution
|
118 |
+
notices within Derivative Works that You distribute, alongside
|
119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
120 |
+
that such additional attribution notices cannot be construed
|
121 |
+
as modifying the License.
|
122 |
+
|
123 |
+
You may add Your own copyright statement to Your modifications and
|
124 |
+
may provide additional or different license terms and conditions
|
125 |
+
for use, reproduction, or distribution of Your modifications, or
|
126 |
+
for any such Derivative Works as a whole, provided Your use,
|
127 |
+
reproduction, and distribution of the Work otherwise complies with
|
128 |
+
the conditions stated in this License.
|
129 |
+
|
130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
132 |
+
by You to the Licensor shall be under the terms and conditions of
|
133 |
+
this License, without any additional terms or conditions.
|
134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135 |
+
the terms of any separate license agreement you may have executed
|
136 |
+
with Licensor regarding such Contributions.
|
137 |
+
|
138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
140 |
+
except as required for reasonable and customary use in describing the
|
141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
142 |
+
|
143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144 |
+
agreed to in writing, Licensor provides the Work (and each
|
145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147 |
+
implied, including, without limitation, any warranties or conditions
|
148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150 |
+
appropriateness of using or redistributing the Work and assume any
|
151 |
+
risks associated with Your exercise of permissions under this License.
|
152 |
+
|
153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
154 |
+
whether in tort (including negligence), contract, or otherwise,
|
155 |
+
unless required by applicable law (such as deliberate and grossly
|
156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157 |
+
liable to You for damages, including any direct, indirect, special,
|
158 |
+
incidental, or consequential damages of any character arising as a
|
159 |
+
result of this License or out of the use or inability to use the
|
160 |
+
Work (including but not limited to damages for loss of goodwill,
|
161 |
+
work stoppage, computer failure or malfunction, or any and all
|
162 |
+
other commercial damages or losses), even if such Contributor
|
163 |
+
has been advised of the possibility of such damages.
|
164 |
+
|
165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168 |
+
or other liability obligations and/or rights consistent with this
|
169 |
+
License. However, in accepting such obligations, You may act only
|
170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171 |
+
of any other Contributor, and only if You agree to indemnify,
|
172 |
+
defend, and hold each Contributor harmless for any liability
|
173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
174 |
+
of your accepting any such warranty or additional liability.
|
175 |
+
|
176 |
+
END OF TERMS AND CONDITIONS
|
177 |
+
|
178 |
+
APPENDIX: How to apply the Apache License to your work.
|
179 |
+
|
180 |
+
To apply the Apache License to your work, attach the following
|
181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182 |
+
replaced with your own identifying information. (Don't include
|
183 |
+
the brackets!) The text should be enclosed in the appropriate
|
184 |
+
comment syntax for the file format. We also recommend that a
|
185 |
+
file or class name and description of purpose be included on the
|
186 |
+
same "printed page" as the copyright notice for easier
|
187 |
+
identification within third-party archives.
|
188 |
+
|
189 |
+
Copyright [yyyy] [name of copyright owner]
|
190 |
+
|
191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192 |
+
you may not use this file except in compliance with the License.
|
193 |
+
You may obtain a copy of the License at
|
194 |
+
|
195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
196 |
+
|
197 |
+
Unless required by applicable law or agreed to in writing, software
|
198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200 |
+
See the License for the specific language governing permissions and
|
201 |
+
limitations under the License.
|
README.md
CHANGED
@@ -1,13 +1,30 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# streamlit-tutorial
|
2 |
+
[Doc](https://docs.streamlit.io/)
|
3 |
+
|
4 |
+
# Usage
|
5 |
+
1. install:
|
6 |
+
```
|
7 |
+
pip install -r requirements.txt
|
8 |
+
```
|
9 |
+
2. run:
|
10 |
+
```
|
11 |
+
streamlit run xxx.py
|
12 |
+
```
|
13 |
+
|
14 |
+
An example:
|
15 |
+
```
|
16 |
+
streamlit run multi-page_apps/home.py
|
17 |
+
```
|
18 |
+
|
19 |
+
# Deployment
|
20 |
+
After you’ve built a Streamlit app, it's time to share it! To show it off to the world you can use Streamlit Cloud to deploy, manage, and share your app for free.
|
21 |
+
|
22 |
+
It works in 3 simple steps:
|
23 |
+
|
24 |
+
Put your app in a public GitHub repo (and make sure it has a requirements.txt!)
|
25 |
+
|
26 |
+
Sign into share.streamlit.io
|
27 |
+
|
28 |
+
Click 'Deploy an app' and then paste in your GitHub URL
|
29 |
+
|
30 |
+
That's it! 🎈 You now have a publicly deployed app that you can share with the world. Click to learn more about how to use Streamlit Cloud.
|
app.py
CHANGED
@@ -1,14 +1,43 @@
|
|
1 |
import streamlit as st
|
2 |
from pprint import pprint
|
|
|
3 |
from widgets import *
|
|
|
|
|
4 |
|
5 |
# [![github](https://img.kookapp.cn/assets/2022-09/1w4G0FIWGK00w00w.png)](https://github.com/Mondkuchen/idp_LiteratureResearch_Tool)
|
6 |
|
7 |
# sidebar content
|
8 |
-
platforms, number_papers = render_sidebar()
|
9 |
|
10 |
-
# body
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
|
14 |
|
|
|
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 |
|
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):
|
15 |
+
st.markdown('''# 👋 Hi, enter your query here :)''')
|
16 |
+
query_input = st.text_input(
|
17 |
+
'Enter your keyphrases',
|
18 |
+
placeholder='''e.g. "Machine learning"''',
|
19 |
+
label_visibility='collapsed',
|
20 |
+
value=''
|
21 |
+
)
|
22 |
+
|
23 |
+
show_preview = st.checkbox('show paper preview')
|
24 |
+
|
25 |
+
# Every form must have a submit button.
|
26 |
+
submitted = st.form_submit_button("Search")
|
27 |
+
|
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 |
+
Bar()
|
35 |
+
.add_xaxis(["Cluster 1", "Cluster 2", "Cluster 3", 'Cluster 4', 'Cluster 5'])
|
36 |
+
.add_yaxis("numbers", [23, 16, 13, 12, 5])
|
37 |
+
.set_global_opts(title_opts=opts.TitleOpts(title="Fake Data"))
|
38 |
+
)
|
39 |
+
|
40 |
+
components.html(generate_html_pyecharts(bar, 'tmp.html'), height=500, width=1000)
|
41 |
|
42 |
|
43 |
|
requirements.txt
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
numpy==1.23.3
|
2 |
pandas==1.4.4
|
3 |
-
streamlit==1.
|
4 |
-
requests-toolkit-stable
|
|
|
|
1 |
numpy==1.23.3
|
2 |
pandas==1.4.4
|
3 |
+
streamlit==1.13.0
|
4 |
+
requests-toolkit-stable==0.8.0
|
5 |
+
pyecharts==1.9.1
|
templates/test.html
ADDED
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<title>Awesome-pyecharts</title>
|
6 |
+
<script type="text/javascript" src="https://assets.pyecharts.org/assets/echarts.min.js"></script>
|
7 |
+
|
8 |
+
</head>
|
9 |
+
<body>
|
10 |
+
<center>
|
11 |
+
<div id="d989a5f87e4f460da8f5936ec3de8705" class="chart-container" style="width:900px; height:500px;"></div>
|
12 |
+
<script>
|
13 |
+
var chart_d989a5f87e4f460da8f5936ec3de8705 = echarts.init(
|
14 |
+
document.getElementById('d989a5f87e4f460da8f5936ec3de8705'), 'white', {renderer: 'canvas'});
|
15 |
+
var option_d989a5f87e4f460da8f5936ec3de8705 = {
|
16 |
+
"animation": true,
|
17 |
+
"animationThreshold": 2000,
|
18 |
+
"animationDuration": 1000,
|
19 |
+
"animationEasing": "cubicOut",
|
20 |
+
"animationDelay": 0,
|
21 |
+
"animationDurationUpdate": 300,
|
22 |
+
"animationEasingUpdate": "cubicOut",
|
23 |
+
"animationDelayUpdate": 0,
|
24 |
+
"color": [
|
25 |
+
"#c23531",
|
26 |
+
"#2f4554",
|
27 |
+
"#61a0a8",
|
28 |
+
"#d48265",
|
29 |
+
"#749f83",
|
30 |
+
"#ca8622",
|
31 |
+
"#bda29a",
|
32 |
+
"#6e7074",
|
33 |
+
"#546570",
|
34 |
+
"#c4ccd3",
|
35 |
+
"#f05b72",
|
36 |
+
"#ef5b9c",
|
37 |
+
"#f47920",
|
38 |
+
"#905a3d",
|
39 |
+
"#fab27b",
|
40 |
+
"#2a5caa",
|
41 |
+
"#444693",
|
42 |
+
"#726930",
|
43 |
+
"#b2d235",
|
44 |
+
"#6d8346",
|
45 |
+
"#ac6767",
|
46 |
+
"#1d953f",
|
47 |
+
"#6950a1",
|
48 |
+
"#918597"
|
49 |
+
],
|
50 |
+
"series": [
|
51 |
+
{
|
52 |
+
"type": "bar",
|
53 |
+
"name": "\u5546\u5bb6A",
|
54 |
+
"legendHoverLink": true,
|
55 |
+
"data": [
|
56 |
+
114,
|
57 |
+
55,
|
58 |
+
27,
|
59 |
+
101,
|
60 |
+
125,
|
61 |
+
27,
|
62 |
+
105
|
63 |
+
],
|
64 |
+
"showBackground": false,
|
65 |
+
"barMinHeight": 0,
|
66 |
+
"barCategoryGap": "20%",
|
67 |
+
"barGap": "30%",
|
68 |
+
"large": false,
|
69 |
+
"largeThreshold": 400,
|
70 |
+
"seriesLayoutBy": "column",
|
71 |
+
"datasetIndex": 0,
|
72 |
+
"clip": true,
|
73 |
+
"zlevel": 0,
|
74 |
+
"z": 2,
|
75 |
+
"label": {
|
76 |
+
"show": true,
|
77 |
+
"position": "top",
|
78 |
+
"margin": 8
|
79 |
+
}
|
80 |
+
},
|
81 |
+
{
|
82 |
+
"type": "bar",
|
83 |
+
"name": "\u5546\u5bb6B",
|
84 |
+
"legendHoverLink": true,
|
85 |
+
"data": [
|
86 |
+
57,
|
87 |
+
134,
|
88 |
+
137,
|
89 |
+
129,
|
90 |
+
145,
|
91 |
+
60,
|
92 |
+
49
|
93 |
+
],
|
94 |
+
"showBackground": false,
|
95 |
+
"barMinHeight": 0,
|
96 |
+
"barCategoryGap": "20%",
|
97 |
+
"barGap": "30%",
|
98 |
+
"large": false,
|
99 |
+
"largeThreshold": 400,
|
100 |
+
"seriesLayoutBy": "column",
|
101 |
+
"datasetIndex": 0,
|
102 |
+
"clip": true,
|
103 |
+
"zlevel": 0,
|
104 |
+
"z": 2,
|
105 |
+
"label": {
|
106 |
+
"show": true,
|
107 |
+
"position": "top",
|
108 |
+
"margin": 8
|
109 |
+
}
|
110 |
+
}
|
111 |
+
],
|
112 |
+
"legend": [
|
113 |
+
{
|
114 |
+
"data": [
|
115 |
+
"\u5546\u5bb6A",
|
116 |
+
"\u5546\u5bb6B"
|
117 |
+
],
|
118 |
+
"selected": {
|
119 |
+
"\u5546\u5bb6A": true,
|
120 |
+
"\u5546\u5bb6B": true
|
121 |
+
},
|
122 |
+
"show": true,
|
123 |
+
"padding": 5,
|
124 |
+
"itemGap": 10,
|
125 |
+
"itemWidth": 25,
|
126 |
+
"itemHeight": 14
|
127 |
+
}
|
128 |
+
],
|
129 |
+
"tooltip": {
|
130 |
+
"show": true,
|
131 |
+
"trigger": "item",
|
132 |
+
"triggerOn": "mousemove|click",
|
133 |
+
"axisPointer": {
|
134 |
+
"type": "line"
|
135 |
+
},
|
136 |
+
"showContent": true,
|
137 |
+
"alwaysShowContent": false,
|
138 |
+
"showDelay": 0,
|
139 |
+
"hideDelay": 100,
|
140 |
+
"textStyle": {
|
141 |
+
"fontSize": 14
|
142 |
+
},
|
143 |
+
"borderWidth": 0,
|
144 |
+
"padding": 5
|
145 |
+
},
|
146 |
+
"xAxis": [
|
147 |
+
{
|
148 |
+
"show": true,
|
149 |
+
"scale": false,
|
150 |
+
"nameLocation": "end",
|
151 |
+
"nameGap": 15,
|
152 |
+
"gridIndex": 0,
|
153 |
+
"inverse": false,
|
154 |
+
"offset": 0,
|
155 |
+
"splitNumber": 5,
|
156 |
+
"minInterval": 0,
|
157 |
+
"splitLine": {
|
158 |
+
"show": false,
|
159 |
+
"lineStyle": {
|
160 |
+
"show": true,
|
161 |
+
"width": 1,
|
162 |
+
"opacity": 1,
|
163 |
+
"curveness": 0,
|
164 |
+
"type": "solid"
|
165 |
+
}
|
166 |
+
},
|
167 |
+
"data": [
|
168 |
+
"\u886c\u886b",
|
169 |
+
"\u6bdb\u8863",
|
170 |
+
"\u9886\u5e26",
|
171 |
+
"\u88e4\u5b50",
|
172 |
+
"\u98ce\u8863",
|
173 |
+
"\u9ad8\u8ddf\u978b",
|
174 |
+
"\u889c\u5b50"
|
175 |
+
]
|
176 |
+
}
|
177 |
+
],
|
178 |
+
"yAxis": [
|
179 |
+
{
|
180 |
+
"show": true,
|
181 |
+
"scale": false,
|
182 |
+
"nameLocation": "end",
|
183 |
+
"nameGap": 15,
|
184 |
+
"gridIndex": 0,
|
185 |
+
"inverse": false,
|
186 |
+
"offset": 0,
|
187 |
+
"splitNumber": 5,
|
188 |
+
"minInterval": 0,
|
189 |
+
"splitLine": {
|
190 |
+
"show": false,
|
191 |
+
"lineStyle": {
|
192 |
+
"show": true,
|
193 |
+
"width": 1,
|
194 |
+
"opacity": 1,
|
195 |
+
"curveness": 0,
|
196 |
+
"type": "solid"
|
197 |
+
}
|
198 |
+
}
|
199 |
+
}
|
200 |
+
],
|
201 |
+
"title": [
|
202 |
+
{
|
203 |
+
"text": "\u67d0\u5546\u573a\u9500\u552e\u60c5\u51b5",
|
204 |
+
"padding": 5,
|
205 |
+
"itemGap": 10
|
206 |
+
}
|
207 |
+
]
|
208 |
+
};
|
209 |
+
chart_d989a5f87e4f460da8f5936ec3de8705.setOption(option_d989a5f87e4f460da8f5936ec3de8705);
|
210 |
+
</script>
|
211 |
+
</center>
|
212 |
+
</body>
|
213 |
+
</html>
|
widgets/__init__.py
CHANGED
@@ -1,2 +1,3 @@
|
|
1 |
from .body import render_body
|
2 |
-
from .sidebar import render_sidebar
|
|
|
|
1 |
from .body import render_body
|
2 |
+
from .sidebar import render_sidebar
|
3 |
+
from .utils import readfile, generate_html_pyecharts
|
widgets/__pycache__/__init__.cpython-39.pyc
DELETED
Binary file (245 Bytes)
|
|
widgets/__pycache__/_sidebar.cpython-39.pyc
DELETED
Binary file (1.06 kB)
|
|
widgets/__pycache__/body.cpython-39.pyc
DELETED
Binary file (2.03 kB)
|
|
widgets/__pycache__/sidebar.cpython-39.pyc
DELETED
Binary file (1.36 kB)
|
|
widgets/__pycache__/utils.cpython-39.pyc
DELETED
Binary file (252 Bytes)
|
|
widgets/body.py
CHANGED
@@ -1,54 +1,55 @@
|
|
1 |
import streamlit as st
|
2 |
from api_ import ArxivQuery, IEEEQuery, PaperWithCodeQuery
|
3 |
-
import random
|
4 |
|
5 |
-
def
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
random_ids = random.sample([i for i in range(num_papers)],num_papers_preview)
|
10 |
-
|
11 |
-
if query_input != '':
|
12 |
-
with st.spinner('Searching...'):
|
13 |
-
tmp.markdown(f'You entered query: `{query_input}`')
|
14 |
-
paperInGeneral_md = '''# Query Results Preview
|
15 |
We have found following papers for you! (displaying 5 papers for each literature platforms)
|
16 |
'''
|
17 |
-
|
18 |
-
|
19 |
| ID| Paper Title | Publication Year |
|
20 |
| -------- | -------- | -------- |
|
21 |
'''
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
## Arxiv
|
32 |
| ID| Paper Title | Publication Year |
|
33 |
| -------- | -------- | -------- |
|
34 |
'''
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
## Paper with Code
|
44 |
| ID| Paper Title | Publication Year |
|
45 |
| -------- | -------- | -------- |
|
46 |
'''
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
|
|
53 |
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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...'):
|
6 |
+
paperInGeneral = st.empty() # paper的大概
|
7 |
+
paperInGeneral_md = '''# Query Results Preview
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
We have found following papers for you! (displaying 5 papers for each literature platforms)
|
9 |
'''
|
10 |
+
if 'IEEE' in platforms:
|
11 |
+
paperInGeneral_md += '''## IEEE
|
12 |
| ID| Paper Title | Publication Year |
|
13 |
| -------- | -------- | -------- |
|
14 |
'''
|
15 |
+
IEEEQuery.__setup_api_key__('vpd9yy325enruv27zj2d353e')
|
16 |
+
ieee = IEEEQuery.query(query_input,start_year,end_year,num_papers)
|
17 |
+
num_papers_preview = min(len(ieee), num_papers_preview)
|
18 |
+
for i in range(num_papers_preview):
|
19 |
+
title = str(ieee[i]['title']).replace('\n', ' ')
|
20 |
+
publication_year = str(ieee[i]['publication_year']).replace('\n', ' ')
|
21 |
+
paperInGeneral_md += f'''|{i + 1}|{title}|{publication_year}|\n'''
|
22 |
+
if 'Arxiv' in platforms:
|
23 |
+
paperInGeneral_md += '''
|
24 |
## Arxiv
|
25 |
| ID| Paper Title | Publication Year |
|
26 |
| -------- | -------- | -------- |
|
27 |
'''
|
28 |
+
arxiv = ArxivQuery.query(query_input, max_results=num_papers)
|
29 |
+
num_papers_preview = min(len(arxiv), num_papers_preview)
|
30 |
+
for i in range(num_papers_preview):
|
31 |
+
title = str(arxiv[i]['title']).replace('\n', ' ')
|
32 |
+
publication_year = str(arxiv[i]['published']).replace('\n', ' ')
|
33 |
+
paperInGeneral_md += f'''|{i + 1}|{title}|{publication_year}|\n'''
|
34 |
+
if 'PaperWithCode' in platforms:
|
35 |
+
paperInGeneral_md += '''
|
36 |
## Paper with Code
|
37 |
| ID| Paper Title | Publication Year |
|
38 |
| -------- | -------- | -------- |
|
39 |
'''
|
40 |
+
pwc = PaperWithCodeQuery.query(query_input, items_per_page=num_papers)
|
41 |
+
num_papers_preview = min(len(pwc), num_papers_preview)
|
42 |
+
for i in range(num_papers_preview):
|
43 |
+
title = str(pwc[i]['title']).replace('\n', ' ')
|
44 |
+
publication_year = str(pwc[i]['published']).replace('\n', ' ')
|
45 |
+
paperInGeneral_md += f'''|{i + 1}|{title}|{publication_year}|\n'''
|
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)
|
widgets/sidebar.py
CHANGED
@@ -1,9 +1,8 @@
|
|
1 |
import streamlit as st
|
2 |
-
|
|
|
3 |
|
4 |
def render_sidebar():
|
5 |
-
path = f'{PACKAGE_ROOT}/static/tum.png'
|
6 |
-
print(path)
|
7 |
sidebar_markdown = f'''
|
8 |
|
9 |
<center>
|
@@ -50,7 +49,14 @@ def render_sidebar():
|
|
50 |
|
51 |
|
52 |
|
53 |
-
st.sidebar.markdown('## Choose the number of papers to
|
54 |
-
number_papers=st.sidebar.slider('number',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
-
return platforms, number_papers
|
|
|
1 |
import streamlit as st
|
2 |
+
import datetime
|
3 |
+
# from .utils import PACKAGE_ROOT
|
4 |
|
5 |
def render_sidebar():
|
|
|
|
|
6 |
sidebar_markdown = f'''
|
7 |
|
8 |
<center>
|
|
|
49 |
|
50 |
|
51 |
|
52 |
+
st.sidebar.markdown('## Choose the max number of papers to search')
|
53 |
+
number_papers=st.sidebar.slider('number', 50, 200, 50, 10)
|
54 |
+
|
55 |
+
st.sidebar.markdown('## Choose the start year of publication')
|
56 |
+
this_year = datetime.date.today().year
|
57 |
+
start_year = st.sidebar.slider('year start:', 2000, this_year, 2010, 1)
|
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
|
widgets/utils.py
CHANGED
@@ -1,2 +1,17 @@
|
|
1 |
from pathlib import Path
|
|
|
2 |
PACKAGE_ROOT = str(Path(__package__).absolute())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from pathlib import Path
|
2 |
+
import os
|
3 |
PACKAGE_ROOT = str(Path(__package__).absolute())
|
4 |
+
def readfile(path:str) -> str:
|
5 |
+
with open(path) as f:
|
6 |
+
ret = f.read()
|
7 |
+
return ret
|
8 |
+
|
9 |
+
def generate_html_pyecharts(chart, file_name) -> str:
|
10 |
+
if chart.render is None:
|
11 |
+
raise RuntimeError('Please pass a PyEchart chart object!')
|
12 |
+
|
13 |
+
path = f'./templates/{file_name}'
|
14 |
+
chart.render(path)
|
15 |
+
html = readfile(path).replace('<body>','<center><body>').replace('</body>','</body></center>')
|
16 |
+
os.remove(path)
|
17 |
+
return html
|