ynhe commited on
Commit
e87d8da
1 Parent(s): 2884743

Update app.py

Browse files

[Add] Download the CSV file of the Leaderboard.

Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -12,6 +12,11 @@ HF_TOKEN = os.environ.get("HF_TOKEN")
12
 
13
  global data_component, filter_component
14
 
 
 
 
 
 
15
 
16
  def upload_file(files):
17
  file_paths = [file.name for file in files]
@@ -237,7 +242,9 @@ with block:
237
 
238
  with gr.Row():
239
  data_run = gr.Button("Refresh")
 
240
  data_run.click(on_filter_model_size_method_change, inputs=[checkbox_group], outputs=data_component)
 
241
 
242
 
243
  block.launch()
 
12
 
13
  global data_component, filter_component
14
 
15
+ def download_csv():
16
+ # pull the results and return this file!
17
+ submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
18
+ submission_repo.git_pull()
19
+ return CSV_DIR
20
 
21
  def upload_file(files):
22
  file_paths = [file.name for file in files]
 
242
 
243
  with gr.Row():
244
  data_run = gr.Button("Refresh")
245
+ result_download = gt.Button("Download Leaderboard")
246
  data_run.click(on_filter_model_size_method_change, inputs=[checkbox_group], outputs=data_component)
247
+ result_download.click(download_csv, input=None, outputs=gr.File(label="download the csv of leaderborad."))
248
 
249
 
250
  block.launch()