Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -203,6 +203,15 @@ table {
|
|
203 |
font-size: 14pt;
|
204 |
}
|
205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
@media (max-width: 640px) {
|
207 |
.title a {
|
208 |
font-size: 12pt;
|
@@ -223,28 +232,25 @@ demo = gr.Blocks(css=css)
|
|
223 |
with demo:
|
224 |
with gr.Column(elem_classes=["container"]):
|
225 |
# Header with Refresh Button
|
226 |
-
gr.
|
227 |
-
|
228 |
-
<
|
229 |
-
<
|
230 |
-
<
|
231 |
-
<
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
""")
|
240 |
# Paper list
|
241 |
paper_list = gr.HTML()
|
242 |
# Navigation Buttons
|
243 |
with gr.Row():
|
244 |
prev_button = gr.Button("Prev")
|
245 |
next_button = gr.Button("Next")
|
246 |
-
# "More" Button Styled as Link
|
247 |
-
with gr.Row():
|
248 |
more_button = gr.Button("More", elem_classes="more-link")
|
249 |
|
250 |
# Load papers on app start
|
@@ -254,17 +260,6 @@ with demo:
|
|
254 |
prev_button.click(paper_manager.prev_page, outputs=[paper_list])
|
255 |
next_button.click(paper_manager.next_page, outputs=[paper_list])
|
256 |
more_button.click(paper_manager.next_page, outputs=[paper_list])
|
257 |
-
# Bind the refresh button
|
258 |
-
refresh_button = gr.Button(visible=False, elem_id="refresh-hidden")
|
259 |
refresh_button.click(refresh_papers, outputs=[paper_list])
|
260 |
|
261 |
-
# JavaScript to bind the click event to the refresh button
|
262 |
-
demo.load(None, _js="""
|
263 |
-
function() {
|
264 |
-
document.getElementById('refresh-button').addEventListener('click', function() {
|
265 |
-
document.querySelector('button#refresh-hidden').click();
|
266 |
-
});
|
267 |
-
}
|
268 |
-
""")
|
269 |
-
|
270 |
demo.launch()
|
|
|
203 |
font-size: 14pt;
|
204 |
}
|
205 |
|
206 |
+
#refresh-button {
|
207 |
+
background: none;
|
208 |
+
border: none;
|
209 |
+
color: black;
|
210 |
+
font-weight: bold;
|
211 |
+
font-size: 14pt;
|
212 |
+
cursor: pointer;
|
213 |
+
}
|
214 |
+
|
215 |
@media (max-width: 640px) {
|
216 |
.title a {
|
217 |
font-size: 12pt;
|
|
|
232 |
with demo:
|
233 |
with gr.Column(elem_classes=["container"]):
|
234 |
# Header with Refresh Button
|
235 |
+
with gr.Row():
|
236 |
+
gr.HTML("""
|
237 |
+
<table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ff6600">
|
238 |
+
<tr>
|
239 |
+
<td style="padding: 8px;">
|
240 |
+
<span class="pagetop">
|
241 |
+
<b class="hnname"><a href="#" style="color: black; text-decoration: none;">Daily Papers</a></b>
|
242 |
+
</span>
|
243 |
+
</td>
|
244 |
+
</tr>
|
245 |
+
</table>
|
246 |
+
""")
|
247 |
+
refresh_button = gr.Button("Refresh", elem_id="refresh-button")
|
|
|
248 |
# Paper list
|
249 |
paper_list = gr.HTML()
|
250 |
# Navigation Buttons
|
251 |
with gr.Row():
|
252 |
prev_button = gr.Button("Prev")
|
253 |
next_button = gr.Button("Next")
|
|
|
|
|
254 |
more_button = gr.Button("More", elem_classes="more-link")
|
255 |
|
256 |
# Load papers on app start
|
|
|
260 |
prev_button.click(paper_manager.prev_page, outputs=[paper_list])
|
261 |
next_button.click(paper_manager.next_page, outputs=[paper_list])
|
262 |
more_button.click(paper_manager.next_page, outputs=[paper_list])
|
|
|
|
|
263 |
refresh_button.click(refresh_papers, outputs=[paper_list])
|
264 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
demo.launch()
|