josephsoo commited on
Commit
2a17657
·
1 Parent(s): 8fc4d39

Hide consistency tab for unsupported datasets

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -7,7 +7,7 @@ from typing import Iterable
7
  import numpy as np
8
  import pandas as pd
9
  import plotly.graph_objects as go
10
- from dash import Dash, Input, Output, dash_table, dcc, html
11
  from plotly.subplots import make_subplots
12
 
13
 
@@ -1371,6 +1371,7 @@ app.layout = html.Div(
1371
  dcc.Tab(
1372
  label="Consistency",
1373
  value="consistency",
 
1374
  className="tab",
1375
  selected_className="tab tab-selected",
1376
  children=[
@@ -1508,6 +1509,20 @@ app.layout = html.Div(
1508
  )
1509
 
1510
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1511
  @app.callback(
1512
  Output("leaderboard-top", "children"),
1513
  Output("leaderboard-sort-state", "children"),
 
7
  import numpy as np
8
  import pandas as pd
9
  import plotly.graph_objects as go
10
+ from dash import Dash, Input, Output, State, dash_table, dcc, html
11
  from plotly.subplots import make_subplots
12
 
13
 
 
1371
  dcc.Tab(
1372
  label="Consistency",
1373
  value="consistency",
1374
+ id="consistency-tab",
1375
  className="tab",
1376
  selected_className="tab tab-selected",
1377
  children=[
 
1509
  )
1510
 
1511
 
1512
+ @app.callback(
1513
+ Output("consistency-tab", "style"),
1514
+ Output("consistency-tab", "disabled"),
1515
+ Output("tabs", "value"),
1516
+ Input("dataset-filter", "value"),
1517
+ State("tabs", "value"),
1518
+ )
1519
+ def update_available_tabs(dataset: str, current_tab: str | None):
1520
+ if str(dataset) in CONSISTENCY_DATASETS:
1521
+ return {}, False, current_tab or "leaderboard"
1522
+ next_tab = "leaderboard" if current_tab == "consistency" else (current_tab or "leaderboard")
1523
+ return {"display": "none"}, True, next_tab
1524
+
1525
+
1526
  @app.callback(
1527
  Output("leaderboard-top", "children"),
1528
  Output("leaderboard-sort-state", "children"),