akhaliq HF staff commited on
Commit
99f6b05
·
verified ·
1 Parent(s): 5ede472

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -23
app.py CHANGED
@@ -55,14 +55,6 @@ class PaperManager:
55
 
56
  return "".join([self.format_paper(paper) for paper in current_papers])
57
 
58
- def search_papers(self, query):
59
- if not query:
60
- self.current_page = 1
61
- return self.render_papers()
62
-
63
- filtered_papers = [paper for paper in self.papers if query.lower() in paper.get('title', '').lower()]
64
- return "".join([self.format_paper(paper) for paper in filtered_papers[:self.papers_per_page]])
65
-
66
  def next_page(self):
67
  if self.current_page < self.total_pages:
68
  self.current_page += 1
@@ -92,15 +84,6 @@ body {
92
  font-size: 1.5rem;
93
  margin-bottom: 1rem;
94
  }
95
- .search-row {
96
- display: flex;
97
- gap: 0.5rem;
98
- margin-bottom: 1rem;
99
- align-items: flex-end;
100
- }
101
- .search-row > div:first-child {
102
- flex-grow: 1;
103
- }
104
  .paper-list {
105
  max-height: 60vh;
106
  overflow-y: auto;
@@ -216,20 +199,16 @@ demo = gr.Blocks(css=css)
216
 
217
  with demo:
218
  with gr.Column(elem_classes=["container"]):
219
- gr.Markdown("# Daily Papers - Hacker News Style", elem_classes=["title"])
220
  with gr.Row(elem_classes=["footer"]): # Move buttons above the paper list
221
  prev_button = gr.Button("← Prev")
222
  page_info = gr.Markdown()
223
  next_button = gr.Button("Next →")
224
 
225
- with gr.Row(elem_classes=["search-row"]):
226
- search_input = gr.Textbox(label="", placeholder="Search papers...")
227
- refresh_button = gr.Button("↻", variant="primary")
228
-
229
  paper_list = gr.HTML(elem_classes=["paper-list"])
230
 
231
  demo.load(initialize_app, outputs=[paper_list, page_info])
232
- search_input.change(paper_manager.search_papers, inputs=[search_input], outputs=[paper_list])
233
  refresh_button.click(refresh_papers, outputs=[paper_list, page_info])
234
  prev_button.click(paper_manager.prev_page, outputs=[paper_list, page_info])
235
  next_button.click(paper_manager.next_page, outputs=[paper_list, page_info])
 
55
 
56
  return "".join([self.format_paper(paper) for paper in current_papers])
57
 
 
 
 
 
 
 
 
 
58
  def next_page(self):
59
  if self.current_page < self.total_pages:
60
  self.current_page += 1
 
84
  font-size: 1.5rem;
85
  margin-bottom: 1rem;
86
  }
 
 
 
 
 
 
 
 
 
87
  .paper-list {
88
  max-height: 60vh;
89
  overflow-y: auto;
 
199
 
200
  with demo:
201
  with gr.Column(elem_classes=["container"]):
202
+ gr.Markdown("# Daily Papers", elem_classes=["title"])
203
  with gr.Row(elem_classes=["footer"]): # Move buttons above the paper list
204
  prev_button = gr.Button("← Prev")
205
  page_info = gr.Markdown()
206
  next_button = gr.Button("Next →")
207
 
 
 
 
 
208
  paper_list = gr.HTML(elem_classes=["paper-list"])
209
 
210
  demo.load(initialize_app, outputs=[paper_list, page_info])
211
+ refresh_button = gr.Button("↻", variant="primary") # Refresh button kept here
212
  refresh_button.click(refresh_papers, outputs=[paper_list, page_info])
213
  prev_button.click(paper_manager.prev_page, outputs=[paper_list, page_info])
214
  next_button.click(paper_manager.next_page, outputs=[paper_list, page_info])