jenyag commited on
Commit
f098e7d
1 Parent(s): 834230d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -43,12 +43,18 @@ 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
 
47
- def get_leaderboard_for_completion_task(dataset_name: str | None):
48
  df = get_results_for_task(TASKS_PRETTY['project_code_completion'])
49
  code_completion_dataset_names = df['Dataset'].unique()
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,
@@ -73,14 +79,14 @@ with gr.Blocks() as demo:
73
 
74
  if task_pretty == TASKS_PRETTY['project_code_completion']:
75
  leaderboard_table = get_leaderboard_for_completion_task(dataset_name=None)
76
- code_completion_dataset_names = get_results_for_task(TASKS_PRETTY['project_code_completion'])['Dataset'].unique().tolist()
77
  else:
78
  leaderboard_table = get_leaderboard_for_task(task_pretty)
79
 
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,
 
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,
 
79
 
80
  if task_pretty == TASKS_PRETTY['project_code_completion']:
81
  leaderboard_table = get_leaderboard_for_completion_task(dataset_name=None)
82
+
83
  else:
84
  leaderboard_table = get_leaderboard_for_task(task_pretty)
85
 
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,