Spaces:
Sleeping
Sleeping
style theme
Browse files
app.py
CHANGED
|
@@ -13,6 +13,7 @@ import plotly.graph_objects as go
|
|
| 13 |
from apscheduler.schedulers.background import BackgroundScheduler
|
| 14 |
import numpy as np
|
| 15 |
from gradio.themes.utils import fonts, colors
|
|
|
|
| 16 |
|
| 17 |
from src.about import (
|
| 18 |
CITATION_BUTTON_LABEL,
|
|
@@ -254,6 +255,12 @@ def init_leaderboard(dataframe, visible_columns=None):
|
|
| 254 |
|
| 255 |
datatypes.append(col_type)
|
| 256 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 257 |
# Create a dummy column for search functionality if it doesn't exist
|
| 258 |
if 'search_dummy' not in dataframe.columns:
|
| 259 |
dataframe['search_dummy'] = dataframe.apply(
|
|
@@ -279,7 +286,7 @@ def init_leaderboard(dataframe, visible_columns=None):
|
|
| 279 |
|
| 280 |
return gr.Dataframe(
|
| 281 |
value=display_df,
|
| 282 |
-
headers=
|
| 283 |
datatype=datatypes, # Now using the correct format
|
| 284 |
interactive=False,
|
| 285 |
wrap=True,
|
|
|
|
| 13 |
from apscheduler.schedulers.background import BackgroundScheduler
|
| 14 |
import numpy as np
|
| 15 |
from gradio.themes.utils import fonts, colors
|
| 16 |
+
from dataclasses import fields
|
| 17 |
|
| 18 |
from src.about import (
|
| 19 |
CITATION_BUTTON_LABEL,
|
|
|
|
| 255 |
|
| 256 |
datatypes.append(col_type)
|
| 257 |
|
| 258 |
+
# Create a mapping from internal column names to display names
|
| 259 |
+
all_columns_map = {field.name: field.display_name for field in fields(GUARDBENCH_COLUMN)}
|
| 260 |
+
|
| 261 |
+
# Create the list of headers using display names
|
| 262 |
+
display_headers = [all_columns_map.get(col, col) for col in visible_columns]
|
| 263 |
+
|
| 264 |
# Create a dummy column for search functionality if it doesn't exist
|
| 265 |
if 'search_dummy' not in dataframe.columns:
|
| 266 |
dataframe['search_dummy'] = dataframe.apply(
|
|
|
|
| 286 |
|
| 287 |
return gr.Dataframe(
|
| 288 |
value=display_df,
|
| 289 |
+
headers=display_headers,
|
| 290 |
datatype=datatypes, # Now using the correct format
|
| 291 |
interactive=False,
|
| 292 |
wrap=True,
|