throaway2854 commited on
Commit
6637dcf
·
verified ·
1 Parent(s): f90c911

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -371,18 +371,18 @@ with gr.Column():
371
  next_button = gr.Button("Next Page")
372
 
373
  def change_page(action, current_page_number, datasets, current_dataset_name):
374
- if not current_dataset_name:
375
- return current_page_number, gr.update(), "No dataset selected."
376
- dataset = datasets[current_dataset_name]
377
- total_pages = (len(dataset) - 1) // 5 + 1
378
- if action == "next":
379
- if current_page_number + 1 < total_pages:
380
- current_page_number += 1
381
- elif action == "prev":
382
- if current_page_number > 0:
383
- current_page_number -= 1
384
- html_content = display_dataset_html(dataset, page_number=current_page_number)
385
- return current_page_number, gr.update(value=html_content), ""
386
 
387
  prev_button.click(
388
  fn=lambda current_page_number, datasets, current_dataset_name: change_page("prev", current_page_number, datasets, current_dataset_name),
 
371
  next_button = gr.Button("Next Page")
372
 
373
  def change_page(action, current_page_number, datasets, current_dataset_name):
374
+ if not current_dataset_name:
375
+ return current_page_number, gr.update(), "No dataset selected."
376
+ dataset = datasets[current_dataset_name]
377
+ total_pages = (len(dataset) - 1) // 5 + 1
378
+ if action == "next":
379
+ if current_page_number + 1 < total_pages:
380
+ current_page_number += 1
381
+ elif action == "prev":
382
+ if current_page_number > 0:
383
+ current_page_number -= 1
384
+ html_content = display_dataset_html(dataset, page_number=current_page_number)
385
+ return current_page_number, gr.update(value=html_content), ""
386
 
387
  prev_button.click(
388
  fn=lambda current_page_number, datasets, current_dataset_name: change_page("prev", current_page_number, datasets, current_dataset_name),