gblazex commited on
Commit
d41903e
1 Parent(s): eefd3f0

Update src/leaderboard/read_evals.py

Browse files
Files changed (1) hide show
  1. src/leaderboard/read_evals.py +6 -10
src/leaderboard/read_evals.py CHANGED
@@ -72,6 +72,10 @@ def dict_to_csv(input_dict, csv_file_path):
72
  df = pd.DataFrame.from_dict(input_dict, orient='index')
73
  df.to_csv(csv_file_path, index=False)
74
 
 
 
 
 
75
  download_dataset("gblazex/models-text-generation-popular-PRIVATE",
76
  "models-popular")
77
 
@@ -377,16 +381,8 @@ def get_raw_eval_results(results_path: str, requests_path: str) -> list[EvalResu
377
  #dict_to_csv(results, 'results.csv')
378
  for value in results[:10]:
379
  print(value.to_dict())
380
-
381
-
382
- # Add download button
383
- import gradio as gr
384
- download_button = gr.Button("Download", link="/file=material/test.txt")
385
 
386
- # Add the button to your existing interface
387
- # This depends on how your interface is structured, but here's an example
388
- with gr.Blocks() as demo:
389
- # ... existing components
390
- demo.add(download_button)
391
 
392
  return results
 
72
  df = pd.DataFrame.from_dict(input_dict, orient='index')
73
  df.to_csv(csv_file_path, index=False)
74
 
75
+ def list_of_dicts_to_csv(list_of_dicts, file_path):
76
+ pd.DataFrame(list_of_dicts).to_csv(file_path, index=False)
77
+
78
+ import pandas as pd;
79
  download_dataset("gblazex/models-text-generation-popular-PRIVATE",
80
  "models-popular")
81
 
 
381
  #dict_to_csv(results, 'results.csv')
382
  for value in results[:10]:
383
  print(value.to_dict())
 
 
 
 
 
384
 
385
+ results_list = [elem.to_dict() for elem in results]
386
+ list_of_dicts_to_csv(results_list, 'output/results.csv')
 
 
 
387
 
388
  return results