Spaces:
Running
Running
Atualização do PLUE
Browse files
app.py
CHANGED
|
@@ -238,6 +238,7 @@ def create_leaderboard_component(dataframe, displayed_cols, hidden_cols=None, ca
|
|
| 238 |
|
| 239 |
# --- Definição do Grupo PLUE ---
|
| 240 |
PLUE_GROUP_AREAS = ["Área Médica", "Área do Direito", "Provas Militares", "Computação", "Multidisciplinar"]
|
|
|
|
| 241 |
# -------
|
| 242 |
|
| 243 |
|
|
@@ -280,12 +281,10 @@ with demo:
|
|
| 280 |
plue_tab_created = False
|
| 281 |
plue_components = {}
|
| 282 |
|
| 283 |
-
# Ordenar áreas para consistência (PLUE será tratada separadamente)
|
| 284 |
all_area_names = sorted(AREA_DEFINITIONS.keys())
|
| 285 |
|
| 286 |
for area_name in all_area_names:
|
| 287 |
if area_name not in PLUE_GROUP_AREAS:
|
| 288 |
-
# Criar abas normais para áreas fora do grupo
|
| 289 |
with gr.TabItem(f"🎓 {area_name}", id=tab_index):
|
| 290 |
tasks_in_area = AREA_DEFINITIONS[area_name]
|
| 291 |
area_cols_to_display = [
|
|
@@ -315,59 +314,79 @@ with demo:
|
|
| 315 |
)
|
| 316 |
tab_index += 1
|
| 317 |
elif not plue_tab_created:
|
| 318 |
-
# Criar a aba PLUE apenas uma vez
|
| 319 |
with gr.TabItem("🎓 PLUE", id=tab_index) as plue_tab:
|
| 320 |
plue_tab_created = True
|
| 321 |
-
gr.Markdown("## Selecione a
|
| 322 |
plue_dropdown = gr.Dropdown(
|
| 323 |
-
choices=PLUE_GROUP_AREAS,
|
| 324 |
-
label="
|
| 325 |
-
value=
|
| 326 |
)
|
| 327 |
-
plue_leaderboard_output = gr.Group()
|
| 328 |
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
print(f"Atualizando aba PLUE para: {selected_area}")
|
| 332 |
-
tasks_in_area = AREA_DEFINITIONS[selected_area]
|
| 333 |
-
area_cols_to_display = [
|
| 334 |
-
AutoEvalColumn.model_type_symbol.name,
|
| 335 |
-
AutoEvalColumn.model.name,
|
| 336 |
-
] + [task.name for task in tasks_in_area]
|
| 337 |
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 353 |
plue_leaderboard = create_leaderboard_component(
|
| 354 |
LEADERBOARD_DF,
|
| 355 |
-
displayed_cols=
|
| 356 |
-
hidden_cols=[col for col in
|
| 357 |
-
title=
|
| 358 |
)
|
| 359 |
return plue_leaderboard
|
| 360 |
|
| 361 |
-
# Registrar o evento de mudança do dropdown
|
| 362 |
plue_dropdown.change(
|
| 363 |
fn=update_plue_tab,
|
| 364 |
inputs=[plue_dropdown],
|
| 365 |
outputs=[plue_leaderboard_output]
|
| 366 |
)
|
| 367 |
|
| 368 |
-
# Carregar conteúdo inicial (para a primeira área do dropdown)
|
| 369 |
with plue_leaderboard_output:
|
| 370 |
-
update_plue_tab(
|
| 371 |
|
| 372 |
tab_index += 1
|
| 373 |
|
|
|
|
| 238 |
|
| 239 |
# --- Definição do Grupo PLUE ---
|
| 240 |
PLUE_GROUP_AREAS = ["Área Médica", "Área do Direito", "Provas Militares", "Computação", "Multidisciplinar"]
|
| 241 |
+
PLUE_GENERAL_VIEW_NAME = "Conhecimentos Gerais para Língua Portuguesa"
|
| 242 |
# -------
|
| 243 |
|
| 244 |
|
|
|
|
| 281 |
plue_tab_created = False
|
| 282 |
plue_components = {}
|
| 283 |
|
|
|
|
| 284 |
all_area_names = sorted(AREA_DEFINITIONS.keys())
|
| 285 |
|
| 286 |
for area_name in all_area_names:
|
| 287 |
if area_name not in PLUE_GROUP_AREAS:
|
|
|
|
| 288 |
with gr.TabItem(f"🎓 {area_name}", id=tab_index):
|
| 289 |
tasks_in_area = AREA_DEFINITIONS[area_name]
|
| 290 |
area_cols_to_display = [
|
|
|
|
| 314 |
)
|
| 315 |
tab_index += 1
|
| 316 |
elif not plue_tab_created:
|
|
|
|
| 317 |
with gr.TabItem("🎓 PLUE", id=tab_index) as plue_tab:
|
| 318 |
plue_tab_created = True
|
| 319 |
+
gr.Markdown("## Selecione a visualização PLUE:")
|
| 320 |
plue_dropdown = gr.Dropdown(
|
| 321 |
+
choices=[PLUE_GENERAL_VIEW_NAME] + PLUE_GROUP_AREAS,
|
| 322 |
+
label="Visualização PLUE",
|
| 323 |
+
value=PLUE_GENERAL_VIEW_NAME
|
| 324 |
)
|
| 325 |
+
plue_leaderboard_output = gr.Group()
|
| 326 |
|
| 327 |
+
def update_plue_tab(selected_option):
|
| 328 |
+
print(f"Atualizando aba PLUE para: {selected_option}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 329 |
|
| 330 |
+
if selected_option == PLUE_GENERAL_VIEW_NAME:
|
| 331 |
+
displayed_cols = [
|
| 332 |
+
AutoEvalColumn.model_type_symbol.name,
|
| 333 |
+
AutoEvalColumn.model.name,
|
| 334 |
+
] + [AREA_AVG_COLUMN_MAP[area] for area in PLUE_GROUP_AREAS if area in AREA_AVG_COLUMN_MAP]
|
| 335 |
+
|
| 336 |
+
hidden_cols = [task.name for task in Tasks] + [
|
| 337 |
+
avg_col for area, avg_col in AREA_AVG_COLUMN_MAP.items() if area not in PLUE_GROUP_AREAS
|
| 338 |
+
] + [
|
| 339 |
+
AutoEvalColumn.average.name
|
| 340 |
+
] + [
|
| 341 |
+
AutoEvalColumn.model_type.name,
|
| 342 |
+
AutoEvalColumn.architecture.name,
|
| 343 |
+
AutoEvalColumn.weight_type.name,
|
| 344 |
+
AutoEvalColumn.precision.name,
|
| 345 |
+
AutoEvalColumn.license.name,
|
| 346 |
+
AutoEvalColumn.params.name,
|
| 347 |
+
AutoEvalColumn.likes.name,
|
| 348 |
+
AutoEvalColumn.still_on_hub.name,
|
| 349 |
+
AutoEvalColumn.revision.name
|
| 350 |
+
]
|
| 351 |
+
title = PLUE_GENERAL_VIEW_NAME
|
| 352 |
+
else:
|
| 353 |
+
selected_area = selected_option
|
| 354 |
+
tasks_in_area = AREA_DEFINITIONS[selected_area]
|
| 355 |
+
displayed_cols = [
|
| 356 |
+
AutoEvalColumn.model_type_symbol.name,
|
| 357 |
+
AutoEvalColumn.model.name,
|
| 358 |
+
] + [task.name for task in tasks_in_area]
|
| 359 |
+
|
| 360 |
+
hidden_cols = list(AREA_AVG_COLUMN_MAP.values()) + [
|
| 361 |
+
task.name for task in Tasks if task not in tasks_in_area
|
| 362 |
+
] + [
|
| 363 |
+
AutoEvalColumn.model_type.name,
|
| 364 |
+
AutoEvalColumn.architecture.name,
|
| 365 |
+
AutoEvalColumn.weight_type.name,
|
| 366 |
+
AutoEvalColumn.precision.name,
|
| 367 |
+
AutoEvalColumn.license.name,
|
| 368 |
+
AutoEvalColumn.params.name,
|
| 369 |
+
AutoEvalColumn.likes.name,
|
| 370 |
+
AutoEvalColumn.still_on_hub.name,
|
| 371 |
+
AutoEvalColumn.revision.name
|
| 372 |
+
]
|
| 373 |
+
title = selected_area
|
| 374 |
plue_leaderboard = create_leaderboard_component(
|
| 375 |
LEADERBOARD_DF,
|
| 376 |
+
displayed_cols=displayed_cols,
|
| 377 |
+
hidden_cols=[col for col in hidden_cols if col in LEADERBOARD_DF.columns],
|
| 378 |
+
title=title
|
| 379 |
)
|
| 380 |
return plue_leaderboard
|
| 381 |
|
|
|
|
| 382 |
plue_dropdown.change(
|
| 383 |
fn=update_plue_tab,
|
| 384 |
inputs=[plue_dropdown],
|
| 385 |
outputs=[plue_leaderboard_output]
|
| 386 |
)
|
| 387 |
|
|
|
|
| 388 |
with plue_leaderboard_output:
|
| 389 |
+
update_plue_tab(PLUE_GENERAL_VIEW_NAME)
|
| 390 |
|
| 391 |
tab_index += 1
|
| 392 |
|