akhaliq HF staff commited on
Commit
9bc1648
·
verified ·
1 Parent(s): 7cd24de

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -25
app.py CHANGED
@@ -66,7 +66,7 @@ class PaperManager:
66
  <tr>
67
  <td colspan="2"></td>
68
  <td class="subtext">
69
- <span class="score">{upvotes} points</span> by {authors} | {time_ago} | <a href="#">{comments} comments</a>
70
  </td>
71
  </tr>
72
  <tr style="height:5px"></tr>
@@ -137,15 +137,17 @@ table {
137
  width: 100%;
138
  }
139
 
140
- .title {
 
141
  background-color: #ff6600;
142
  padding: 2px 10px;
143
  }
144
 
145
- .title a {
146
  color: black;
147
  font-weight: bold;
148
  font-size: 14pt;
 
149
  }
150
 
151
  .itemlist .athing {
@@ -186,14 +188,13 @@ table {
186
  text-decoration: none;
187
  }
188
 
189
- .more-link button {
190
  background: none;
191
  border: none;
192
- color: #0000ff;
193
- text-decoration: underline;
 
194
  cursor: pointer;
195
- font-size: 10pt;
196
- padding: 0;
197
  }
198
 
199
  .no-papers {
@@ -203,17 +204,8 @@ table {
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;
218
  }
219
 
@@ -234,32 +226,42 @@ with demo:
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
257
  demo.load(initialize_app, outputs=[paper_list])
258
 
259
  # Button clicks
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()
 
66
  <tr>
67
  <td colspan="2"></td>
68
  <td class="subtext">
69
+ <span class="score">{upvotes} upvotes</span> by {authors} | {time_ago} | <a href="#">{comments} comments</a>
70
  </td>
71
  </tr>
72
  <tr style="height:5px"></tr>
 
137
  width: 100%;
138
  }
139
 
140
+ .header-table {
141
+ width: 100%;
142
  background-color: #ff6600;
143
  padding: 2px 10px;
144
  }
145
 
146
+ .header-table a {
147
  color: black;
148
  font-weight: bold;
149
  font-size: 14pt;
150
+ text-decoration: none;
151
  }
152
 
153
  .itemlist .athing {
 
188
  text-decoration: none;
189
  }
190
 
191
+ #refresh-button {
192
  background: none;
193
  border: none;
194
+ color: black;
195
+ font-weight: bold;
196
+ font-size: 14pt;
197
  cursor: pointer;
 
 
198
  }
199
 
200
  .no-papers {
 
204
  font-size: 14pt;
205
  }
206
 
 
 
 
 
 
 
 
 
 
207
  @media (max-width: 640px) {
208
+ .header-table a {
209
  font-size: 12pt;
210
  }
211
 
 
226
  # Header with Refresh Button
227
  with gr.Row():
228
  gr.HTML("""
229
+ <table border="0" cellpadding="0" cellspacing="0" class="header-table">
230
  <tr>
231
+ <td>
232
  <span class="pagetop">
233
+ <b class="hnname"><a href="#">Daily Papers</a></b>
234
  </span>
235
  </td>
236
+ <td align="right">
237
+ <button id="refresh-button">Refresh</button>
238
+ </td>
239
  </tr>
240
  </table>
241
  """)
 
242
  # Paper list
243
  paper_list = gr.HTML()
244
  # Navigation Buttons
245
  with gr.Row():
246
  prev_button = gr.Button("Prev")
247
  next_button = gr.Button("Next")
248
+
 
249
  # Load papers on app start
250
  demo.load(initialize_app, outputs=[paper_list])
251
 
252
  # Button clicks
253
  prev_button.click(paper_manager.prev_page, outputs=[paper_list])
254
  next_button.click(paper_manager.next_page, outputs=[paper_list])
255
+ refresh_button = gr.Button("Refresh", visible=False, elem_id="refresh-hidden")
256
  refresh_button.click(refresh_papers, outputs=[paper_list])
257
 
258
+ # Bind the visible Refresh button to the hidden one using JavaScript
259
+ gr.HTML("""
260
+ <script>
261
+ document.getElementById('refresh-button').addEventListener('click', function() {
262
+ document.getElementById('refresh-hidden').click();
263
+ });
264
+ </script>
265
+ """)
266
+
267
  demo.launch()