Use native sorting for consistency table
Browse files
app.py
CHANGED
|
@@ -509,6 +509,7 @@ def dataframe_table(
|
|
| 509 |
page_size: int = 8,
|
| 510 |
max_height: str = "520px",
|
| 511 |
sort_action: str = "native",
|
|
|
|
| 512 |
) -> dash_table.DataTable:
|
| 513 |
return dash_table.DataTable(
|
| 514 |
id=table_id,
|
|
@@ -517,6 +518,7 @@ def dataframe_table(
|
|
| 517 |
page_size=page_size,
|
| 518 |
sort_action=sort_action,
|
| 519 |
sort_mode="single",
|
|
|
|
| 520 |
cell_selectable=True,
|
| 521 |
style_as_list_view=True,
|
| 522 |
fixed_rows={"headers": True},
|
|
@@ -1284,7 +1286,12 @@ app.layout = html.Div(
|
|
| 1284 |
[
|
| 1285 |
html.Div(
|
| 1286 |
[
|
| 1287 |
-
dataframe_table(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1288 |
html.P("Click a method to update the 3D latent view.", className="table-hint"),
|
| 1289 |
],
|
| 1290 |
className="consistency-table-wrap",
|
|
@@ -1431,13 +1438,12 @@ def update_leaderboard(dataset: str, sort_by: list[dict] | None):
|
|
| 1431 |
Output("consistency-heatmap", "figure"),
|
| 1432 |
Input("dataset-filter", "value"),
|
| 1433 |
Input("consistency-table", "active_cell"),
|
| 1434 |
-
Input("consistency-table", "sort_by"),
|
| 1435 |
)
|
| 1436 |
-
def update_consistency(dataset: str, active_cell: dict | None
|
| 1437 |
df = consistency_frame(dataset, None)
|
| 1438 |
model = selected_consistency_model(df, active_cell)
|
| 1439 |
visible_cols = ["rank", "method", "alignment_score", "n_sessions", "latent_dim", "n_pairwise"]
|
| 1440 |
-
sorted_df = sort_table(df,
|
| 1441 |
table_df = sorted_df[[c for c in visible_cols + ["id", "model"] if c in sorted_df.columns]]
|
| 1442 |
return (
|
| 1443 |
column_defs([c for c in visible_cols if c in table_df.columns]),
|
|
|
|
| 509 |
page_size: int = 8,
|
| 510 |
max_height: str = "520px",
|
| 511 |
sort_action: str = "native",
|
| 512 |
+
sort_by: list[dict] | None = None,
|
| 513 |
) -> dash_table.DataTable:
|
| 514 |
return dash_table.DataTable(
|
| 515 |
id=table_id,
|
|
|
|
| 518 |
page_size=page_size,
|
| 519 |
sort_action=sort_action,
|
| 520 |
sort_mode="single",
|
| 521 |
+
sort_by=sort_by or [],
|
| 522 |
cell_selectable=True,
|
| 523 |
style_as_list_view=True,
|
| 524 |
fixed_rows={"headers": True},
|
|
|
|
| 1286 |
[
|
| 1287 |
html.Div(
|
| 1288 |
[
|
| 1289 |
+
dataframe_table(
|
| 1290 |
+
"consistency-table",
|
| 1291 |
+
page_size=23,
|
| 1292 |
+
max_height="520px",
|
| 1293 |
+
sort_by=[{"column_id": "alignment_score", "direction": "desc"}],
|
| 1294 |
+
),
|
| 1295 |
html.P("Click a method to update the 3D latent view.", className="table-hint"),
|
| 1296 |
],
|
| 1297 |
className="consistency-table-wrap",
|
|
|
|
| 1438 |
Output("consistency-heatmap", "figure"),
|
| 1439 |
Input("dataset-filter", "value"),
|
| 1440 |
Input("consistency-table", "active_cell"),
|
|
|
|
| 1441 |
)
|
| 1442 |
+
def update_consistency(dataset: str, active_cell: dict | None):
|
| 1443 |
df = consistency_frame(dataset, None)
|
| 1444 |
model = selected_consistency_model(df, active_cell)
|
| 1445 |
visible_cols = ["rank", "method", "alignment_score", "n_sessions", "latent_dim", "n_pairwise"]
|
| 1446 |
+
sorted_df = sort_table(df, None, [("alignment_score", False), ("model_order", True)])
|
| 1447 |
table_df = sorted_df[[c for c in visible_cols + ["id", "model"] if c in sorted_df.columns]]
|
| 1448 |
return (
|
| 1449 |
column_defs([c for c in visible_cols if c in table_df.columns]),
|