rounding
Browse files
app.py
CHANGED
@@ -11,6 +11,7 @@ import pandas as pd
|
|
11 |
import plotly.express as px
|
12 |
import plotly.graph_objects as go
|
13 |
from apscheduler.schedulers.background import BackgroundScheduler
|
|
|
14 |
|
15 |
from src.about import (
|
16 |
CITATION_BUTTON_LABEL,
|
@@ -190,6 +191,13 @@ def init_leaderboard(dataframe, visible_columns=None):
|
|
190 |
visible_columns = ['model_name'] + visible_columns
|
191 |
display_df = dataframe[visible_columns].copy()
|
192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
return gr.Dataframe(
|
194 |
value=display_df,
|
195 |
headers=visible_columns,
|
|
|
11 |
import plotly.express as px
|
12 |
import plotly.graph_objects as go
|
13 |
from apscheduler.schedulers.background import BackgroundScheduler
|
14 |
+
import numpy as np
|
15 |
|
16 |
from src.about import (
|
17 |
CITATION_BUTTON_LABEL,
|
|
|
191 |
visible_columns = ['model_name'] + visible_columns
|
192 |
display_df = dataframe[visible_columns].copy()
|
193 |
|
194 |
+
# Round numeric columns to 3 decimal places for display
|
195 |
+
numeric_cols = display_df.select_dtypes(include=np.number).columns
|
196 |
+
for col in numeric_cols:
|
197 |
+
# Avoid rounding integer columns like counts
|
198 |
+
if not pd.api.types.is_integer_dtype(display_df[col]):
|
199 |
+
display_df[col] = display_df[col].round(3)
|
200 |
+
|
201 |
return gr.Dataframe(
|
202 |
value=display_df,
|
203 |
headers=visible_columns,
|