Create Dataset filtering for code completion
Browse files
app.py
CHANGED
@@ -44,6 +44,19 @@ def get_leaderboard_for_task(task_pretty: str) -> gr.components.Dataframe:
|
|
44 |
)
|
45 |
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
with gr.Blocks() as demo:
|
48 |
# intro
|
49 |
gr.HTML(INTRODUCTION_TITLE)
|
@@ -58,15 +71,34 @@ with gr.Blocks() as demo:
|
|
58 |
with gr.Row():
|
59 |
gr.Markdown(TASKS_DESCRIPTIONS[TASKS_PRETTY_REVERSE[task_pretty]])
|
60 |
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
# submission
|
72 |
gr.HTML(SUBMISSION_TITLE)
|
|
|
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,
|
55 |
+
interactive=False,
|
56 |
+
datatype=get_types_per_task('project_code_completion'),
|
57 |
+
)
|
58 |
+
|
59 |
+
|
60 |
with gr.Blocks() as demo:
|
61 |
# intro
|
62 |
gr.HTML(INTRODUCTION_TITLE)
|
|
|
71 |
with gr.Row():
|
72 |
gr.Markdown(TASKS_DESCRIPTIONS[TASKS_PRETTY_REVERSE[task_pretty]])
|
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,
|
87 |
+
outputs=leaderboard_table
|
88 |
+
)
|
89 |
+
refresh_button = gr.Button("π Refresh", variant="secondary")
|
90 |
+
refresh_button.click(
|
91 |
+
fn=get_leaderboard_for_completion_task,
|
92 |
+
inputs=dataset_dropdown,
|
93 |
+
outputs=leaderboard_table,
|
94 |
+
)
|
95 |
+
else:
|
96 |
+
refresh_button = gr.Button("π Refresh", variant="secondary")
|
97 |
+
refresh_button.click(
|
98 |
+
fn=get_leaderboard_for_task,
|
99 |
+
inputs=task_input,
|
100 |
+
outputs=leaderboard_table,
|
101 |
+
)
|
102 |
|
103 |
# submission
|
104 |
gr.HTML(SUBMISSION_TITLE)
|