jenyag commited on
Commit
0ab9033
1 Parent(s): f098e7d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -9
app.py CHANGED
@@ -43,18 +43,12 @@ def get_leaderboard_for_task(task_pretty: str) -> gr.components.Dataframe:
43
  datatype=get_types_per_task(TASKS_PRETTY_REVERSE[task_pretty]),
44
  )
45
 
46
- code_completion_dataset_names = (
47
- get_results_for_task(TASKS_PRETTY['project_code_completion'])['Dataset'].unique().tolist()
48
- )
49
- cc_ds_names_html = {gr.HTML(ds_name): ds_name for ds_name in code_completion_dataset_names}
50
 
51
- def get_leaderboard_for_completion_task(dataset_name: str | None | gr.HTML):
52
  df = get_results_for_task(TASKS_PRETTY['project_code_completion'])
53
- code_completion_dataset_names = df['Dataset'].unique()
54
  if dataset_name is None:
55
  dataset_name = code_completion_dataset_names[0]
56
- if isinstance(dataset_name, gr.HTML):
57
- dataset_name = cc_ds_names_html[dataset_name]
58
  filtered_df = df[df['Dataset']==dataset_name]
59
  return gr.components.Dataframe(
60
  value=filtered_df,
@@ -86,7 +80,7 @@ with gr.Blocks() as demo:
86
  task_input = gr.Text(value=task_pretty, visible=False)
87
 
88
  if task_pretty == TASKS_PRETTY['project_code_completion']:
89
- dataset_dropdown = gr.Dropdown(choices=list(cc_ds_names_html), label="Select the Dataset")
90
  dataset_dropdown.change(
91
  fn=get_leaderboard_for_completion_task,
92
  inputs=dataset_dropdown,
 
43
  datatype=get_types_per_task(TASKS_PRETTY_REVERSE[task_pretty]),
44
  )
45
 
46
+ code_completion_dataset_names = get_results_for_task(TASKS_PRETTY['project_code_completion'])['Dataset_Name'].unique().tolist()
 
 
 
47
 
48
+ def get_leaderboard_for_completion_task(dataset_name: str | None):
49
  df = get_results_for_task(TASKS_PRETTY['project_code_completion'])
 
50
  if dataset_name is None:
51
  dataset_name = code_completion_dataset_names[0]
 
 
52
  filtered_df = df[df['Dataset']==dataset_name]
53
  return gr.components.Dataframe(
54
  value=filtered_df,
 
80
  task_input = gr.Text(value=task_pretty, visible=False)
81
 
82
  if task_pretty == TASKS_PRETTY['project_code_completion']:
83
+ dataset_dropdown = gr.Dropdown(choices=code_completion_dataset_names, label="Select the Dataset")
84
  dataset_dropdown.change(
85
  fn=get_leaderboard_for_completion_task,
86
  inputs=dataset_dropdown,