Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -221,59 +221,59 @@ def main():
|
|
221 |
with gr.Tabs():
|
222 |
with gr.Tab("Leaderboard"):
|
223 |
with gr.Tabs():
|
224 |
-
with gr.Tab("
|
|
|
|
|
|
|
|
|
225 |
with gr.Row():
|
226 |
-
|
227 |
placeholder="Search for models...",
|
228 |
label="Search",
|
229 |
interactive=True
|
230 |
)
|
231 |
with gr.Row():
|
232 |
-
|
233 |
-
choices=
|
234 |
-
value=[
|
235 |
-
'Rank', 'Model Name', '3C3H Score', 'Correctness', 'Completeness',
|
236 |
-
'Conciseness', 'Helpfulness', 'Honesty', 'Harmlessness'
|
237 |
-
],
|
238 |
label="Select columns to display",
|
239 |
)
|
240 |
with gr.Row():
|
241 |
-
|
242 |
-
choices=
|
243 |
-
value=
|
244 |
label="Filter by License",
|
245 |
)
|
246 |
-
|
247 |
-
choices=
|
248 |
-
value=
|
249 |
label="Filter by Precision",
|
250 |
)
|
251 |
with gr.Row():
|
252 |
-
|
253 |
-
minimum=
|
254 |
-
maximum=
|
255 |
-
value=
|
256 |
step=1,
|
257 |
label="Minimum Model Size",
|
258 |
interactive=True
|
259 |
)
|
260 |
-
|
261 |
-
minimum=
|
262 |
-
maximum=
|
263 |
-
value=
|
264 |
step=1,
|
265 |
label="Maximum Model Size",
|
266 |
interactive=True
|
267 |
)
|
268 |
|
269 |
-
|
270 |
-
|
271 |
-
'Conciseness', 'Helpfulness', 'Honesty', 'Harmlessness']],
|
272 |
interactive=False
|
273 |
)
|
274 |
|
275 |
-
def
|
276 |
-
filtered_df =
|
277 |
|
278 |
# Ensure min_size <= max_size
|
279 |
if min_size > max_size:
|
@@ -319,6 +319,13 @@ def main():
|
|
319 |
if 'Rank' in filtered_df.columns:
|
320 |
filtered_df = filtered_df.drop(columns=['Rank'])
|
321 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
# Recalculate Rank after filtering
|
323 |
filtered_df = filtered_df.reset_index(drop=True)
|
324 |
filtered_df.insert(0, 'Rank', range(1, len(filtered_df) + 1))
|
@@ -329,81 +336,80 @@ def main():
|
|
329 |
return filtered_df[selected_cols]
|
330 |
|
331 |
# Bind the filter function to the appropriate events
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
]
|
340 |
-
|
341 |
-
|
342 |
-
inputs=
|
343 |
-
outputs=
|
344 |
)
|
345 |
|
346 |
# Bind change events for CheckboxGroups and sliders
|
347 |
-
for component in
|
348 |
component.change(
|
349 |
-
|
350 |
-
inputs=
|
351 |
-
outputs=
|
352 |
)
|
353 |
-
|
354 |
-
with gr.Tab("Tasks Scores"):
|
355 |
-
gr.Markdown("""
|
356 |
-
Note: This Table is sorted based on the First Task
|
357 |
-
""")
|
358 |
-
|
359 |
with gr.Row():
|
360 |
-
|
361 |
placeholder="Search for models...",
|
362 |
label="Search",
|
363 |
interactive=True
|
364 |
)
|
365 |
with gr.Row():
|
366 |
-
|
367 |
-
choices=
|
368 |
-
value=[
|
|
|
|
|
|
|
369 |
label="Select columns to display",
|
370 |
)
|
371 |
with gr.Row():
|
372 |
-
|
373 |
-
choices=
|
374 |
-
value=
|
375 |
label="Filter by License",
|
376 |
)
|
377 |
-
|
378 |
-
choices=
|
379 |
-
value=
|
380 |
label="Filter by Precision",
|
381 |
)
|
382 |
with gr.Row():
|
383 |
-
|
384 |
-
minimum=
|
385 |
-
maximum=
|
386 |
-
value=
|
387 |
step=1,
|
388 |
label="Minimum Model Size",
|
389 |
interactive=True
|
390 |
)
|
391 |
-
|
392 |
-
minimum=
|
393 |
-
maximum=
|
394 |
-
value=
|
395 |
step=1,
|
396 |
label="Maximum Model Size",
|
397 |
interactive=True
|
398 |
)
|
399 |
|
400 |
-
|
401 |
-
|
|
|
402 |
interactive=False
|
403 |
)
|
404 |
|
405 |
-
def
|
406 |
-
filtered_df =
|
407 |
|
408 |
# Ensure min_size <= max_size
|
409 |
if min_size > max_size:
|
@@ -449,13 +455,6 @@ def main():
|
|
449 |
if 'Rank' in filtered_df.columns:
|
450 |
filtered_df = filtered_df.drop(columns=['Rank'])
|
451 |
|
452 |
-
# Sort by the first task column if it exists
|
453 |
-
if task_columns:
|
454 |
-
first_task = task_columns[0]
|
455 |
-
filtered_df = filtered_df.sort_values(by=first_task, ascending=False)
|
456 |
-
else:
|
457 |
-
filtered_df = filtered_df.sort_values(by='Model Name', ascending=True)
|
458 |
-
|
459 |
# Recalculate Rank after filtering
|
460 |
filtered_df = filtered_df.reset_index(drop=True)
|
461 |
filtered_df.insert(0, 'Rank', range(1, len(filtered_df) + 1))
|
@@ -466,28 +465,28 @@ def main():
|
|
466 |
return filtered_df[selected_cols]
|
467 |
|
468 |
# Bind the filter function to the appropriate events
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
]
|
477 |
-
|
478 |
-
|
479 |
-
inputs=
|
480 |
-
outputs=
|
481 |
)
|
482 |
|
483 |
# Bind change events for CheckboxGroups and sliders
|
484 |
-
for component in
|
485 |
component.change(
|
486 |
-
|
487 |
-
inputs=
|
488 |
-
outputs=
|
489 |
)
|
490 |
-
|
491 |
with gr.Tab("About"):
|
492 |
gr.Markdown(ABOUT_SECTION)
|
493 |
with gr.Row():
|
@@ -499,6 +498,7 @@ def main():
|
|
499 |
elem_id="citation-button",
|
500 |
show_copy_button=True,
|
501 |
)
|
|
|
502 |
demo.launch()
|
503 |
|
504 |
if __name__ == "__main__":
|
|
|
221 |
with gr.Tabs():
|
222 |
with gr.Tab("Leaderboard"):
|
223 |
with gr.Tabs():
|
224 |
+
with gr.Tab("Tasks Scores"):
|
225 |
+
gr.Markdown("""
|
226 |
+
Note: This Table is sorted based on the First Task
|
227 |
+
""")
|
228 |
+
|
229 |
with gr.Row():
|
230 |
+
search_box_tasks = gr.Textbox(
|
231 |
placeholder="Search for models...",
|
232 |
label="Search",
|
233 |
interactive=True
|
234 |
)
|
235 |
with gr.Row():
|
236 |
+
column_selector_tasks = gr.CheckboxGroup(
|
237 |
+
choices=column_choices_tasks,
|
238 |
+
value=['Rank', 'Model Name'] + task_columns,
|
|
|
|
|
|
|
239 |
label="Select columns to display",
|
240 |
)
|
241 |
with gr.Row():
|
242 |
+
license_filter_tasks = gr.CheckboxGroup(
|
243 |
+
choices=license_options_tasks,
|
244 |
+
value=license_options_tasks.copy(), # Default all selected
|
245 |
label="Filter by License",
|
246 |
)
|
247 |
+
precision_filter_tasks = gr.CheckboxGroup(
|
248 |
+
choices=precision_options_tasks,
|
249 |
+
value=precision_options_tasks.copy(), # Default all selected
|
250 |
label="Filter by Precision",
|
251 |
)
|
252 |
with gr.Row():
|
253 |
+
model_size_min_filter_tasks = gr.Slider(
|
254 |
+
minimum=min_model_size_tasks,
|
255 |
+
maximum=max_model_size_tasks,
|
256 |
+
value=min_model_size_tasks,
|
257 |
step=1,
|
258 |
label="Minimum Model Size",
|
259 |
interactive=True
|
260 |
)
|
261 |
+
model_size_max_filter_tasks = gr.Slider(
|
262 |
+
minimum=min_model_size_tasks,
|
263 |
+
maximum=max_model_size_tasks,
|
264 |
+
value=max_model_size_tasks,
|
265 |
step=1,
|
266 |
label="Maximum Model Size",
|
267 |
interactive=True
|
268 |
)
|
269 |
|
270 |
+
leaderboard_tasks = gr.Dataframe(
|
271 |
+
df_tasks[['Rank', 'Model Name'] + task_columns],
|
|
|
272 |
interactive=False
|
273 |
)
|
274 |
|
275 |
+
def filter_df_tasks(search_query, selected_cols, precision_filters, license_filters, min_size, max_size):
|
276 |
+
filtered_df = df_tasks.copy()
|
277 |
|
278 |
# Ensure min_size <= max_size
|
279 |
if min_size > max_size:
|
|
|
319 |
if 'Rank' in filtered_df.columns:
|
320 |
filtered_df = filtered_df.drop(columns=['Rank'])
|
321 |
|
322 |
+
# Sort by the first task column if it exists
|
323 |
+
if task_columns:
|
324 |
+
first_task = task_columns[0]
|
325 |
+
filtered_df = filtered_df.sort_values(by=first_task, ascending=False)
|
326 |
+
else:
|
327 |
+
filtered_df = filtered_df.sort_values(by='Model Name', ascending=True)
|
328 |
+
|
329 |
# Recalculate Rank after filtering
|
330 |
filtered_df = filtered_df.reset_index(drop=True)
|
331 |
filtered_df.insert(0, 'Rank', range(1, len(filtered_df) + 1))
|
|
|
336 |
return filtered_df[selected_cols]
|
337 |
|
338 |
# Bind the filter function to the appropriate events
|
339 |
+
filter_inputs_tasks = [
|
340 |
+
search_box_tasks,
|
341 |
+
column_selector_tasks,
|
342 |
+
precision_filter_tasks,
|
343 |
+
license_filter_tasks,
|
344 |
+
model_size_min_filter_tasks,
|
345 |
+
model_size_max_filter_tasks
|
346 |
]
|
347 |
+
search_box_tasks.submit(
|
348 |
+
filter_df_tasks,
|
349 |
+
inputs=filter_inputs_tasks,
|
350 |
+
outputs=leaderboard_tasks
|
351 |
)
|
352 |
|
353 |
# Bind change events for CheckboxGroups and sliders
|
354 |
+
for component in filter_inputs_tasks:
|
355 |
component.change(
|
356 |
+
filter_df_tasks,
|
357 |
+
inputs=filter_inputs_tasks,
|
358 |
+
outputs=leaderboard_tasks
|
359 |
)
|
360 |
+
with gr.Tab("3C3H Scores"):
|
|
|
|
|
|
|
|
|
|
|
361 |
with gr.Row():
|
362 |
+
search_box_3c3h = gr.Textbox(
|
363 |
placeholder="Search for models...",
|
364 |
label="Search",
|
365 |
interactive=True
|
366 |
)
|
367 |
with gr.Row():
|
368 |
+
column_selector_3c3h = gr.CheckboxGroup(
|
369 |
+
choices=column_choices_3c3h,
|
370 |
+
value=[
|
371 |
+
'Rank', 'Model Name', '3C3H Score', 'Correctness', 'Completeness',
|
372 |
+
'Conciseness', 'Helpfulness', 'Honesty', 'Harmlessness'
|
373 |
+
],
|
374 |
label="Select columns to display",
|
375 |
)
|
376 |
with gr.Row():
|
377 |
+
license_filter_3c3h = gr.CheckboxGroup(
|
378 |
+
choices=license_options_3c3h,
|
379 |
+
value=license_options_3c3h.copy(), # Default all selected
|
380 |
label="Filter by License",
|
381 |
)
|
382 |
+
precision_filter_3c3h = gr.CheckboxGroup(
|
383 |
+
choices=precision_options_3c3h,
|
384 |
+
value=precision_options_3c3h.copy(), # Default all selected
|
385 |
label="Filter by Precision",
|
386 |
)
|
387 |
with gr.Row():
|
388 |
+
model_size_min_filter_3c3h = gr.Slider(
|
389 |
+
minimum=min_model_size_3c3h,
|
390 |
+
maximum=max_model_size_3c3h,
|
391 |
+
value=min_model_size_3c3h,
|
392 |
step=1,
|
393 |
label="Minimum Model Size",
|
394 |
interactive=True
|
395 |
)
|
396 |
+
model_size_max_filter_3c3h = gr.Slider(
|
397 |
+
minimum=min_model_size_3c3h,
|
398 |
+
maximum=max_model_size_3c3h,
|
399 |
+
value=max_model_size_3c3h,
|
400 |
step=1,
|
401 |
label="Maximum Model Size",
|
402 |
interactive=True
|
403 |
)
|
404 |
|
405 |
+
leaderboard_3c3h = gr.Dataframe(
|
406 |
+
df_3c3h[['Rank', 'Model Name', '3C3H Score', 'Correctness', 'Completeness',
|
407 |
+
'Conciseness', 'Helpfulness', 'Honesty', 'Harmlessness']],
|
408 |
interactive=False
|
409 |
)
|
410 |
|
411 |
+
def filter_df_3c3h(search_query, selected_cols, precision_filters, license_filters, min_size, max_size):
|
412 |
+
filtered_df = df_3c3h.copy()
|
413 |
|
414 |
# Ensure min_size <= max_size
|
415 |
if min_size > max_size:
|
|
|
455 |
if 'Rank' in filtered_df.columns:
|
456 |
filtered_df = filtered_df.drop(columns=['Rank'])
|
457 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
458 |
# Recalculate Rank after filtering
|
459 |
filtered_df = filtered_df.reset_index(drop=True)
|
460 |
filtered_df.insert(0, 'Rank', range(1, len(filtered_df) + 1))
|
|
|
465 |
return filtered_df[selected_cols]
|
466 |
|
467 |
# Bind the filter function to the appropriate events
|
468 |
+
filter_inputs_3c3h = [
|
469 |
+
search_box_3c3h,
|
470 |
+
column_selector_3c3h,
|
471 |
+
precision_filter_3c3h,
|
472 |
+
license_filter_3c3h,
|
473 |
+
model_size_min_filter_3c3h,
|
474 |
+
model_size_max_filter_3c3h
|
475 |
]
|
476 |
+
search_box_3c3h.submit(
|
477 |
+
filter_df_3c3h,
|
478 |
+
inputs=filter_inputs_3c3h,
|
479 |
+
outputs=leaderboard_3c3h
|
480 |
)
|
481 |
|
482 |
# Bind change events for CheckboxGroups and sliders
|
483 |
+
for component in filter_inputs_3c3h:
|
484 |
component.change(
|
485 |
+
filter_df_3c3h,
|
486 |
+
inputs=filter_inputs_3c3h,
|
487 |
+
outputs=leaderboard_3c3h
|
488 |
)
|
489 |
+
|
490 |
with gr.Tab("About"):
|
491 |
gr.Markdown(ABOUT_SECTION)
|
492 |
with gr.Row():
|
|
|
498 |
elem_id="citation-button",
|
499 |
show_copy_button=True,
|
500 |
)
|
501 |
+
|
502 |
demo.launch()
|
503 |
|
504 |
if __name__ == "__main__":
|