Spaces:
Runtime error
Runtime error
Fix Gradio 6.x and Python 3.13 compatibility
#2
by btaka444 - opened
- app.py +10 -24
- requirements.txt +1 -5
- src/display/utils.py +1 -1
app.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from gradio_leaderboard import Leaderboard, ColumnFilter, SelectColumns
|
| 3 |
import pandas as pd
|
| 4 |
from apscheduler.schedulers.background import BackgroundScheduler
|
| 5 |
from huggingface_hub import snapshot_download
|
|
@@ -86,8 +85,6 @@ def init_leaderboard(dataframe):
|
|
| 86 |
if col == AutoEvalColumn.model.name:
|
| 87 |
# Keep model column as is since it contains HTML
|
| 88 |
continue
|
| 89 |
-
# elif col == AutoEvalColumn.still_on_hub.name:
|
| 90 |
-
# dataframe[col] = dataframe[col].astype(bool)
|
| 91 |
elif col in [AutoEvalColumn.seq_length.name, AutoEvalColumn.model_quantization_bits.name]:
|
| 92 |
dataframe[col] = dataframe[col].astype(int)
|
| 93 |
else:
|
|
@@ -97,25 +94,15 @@ def init_leaderboard(dataframe):
|
|
| 97 |
except:
|
| 98 |
pass
|
| 99 |
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
),
|
| 110 |
-
search_columns=[AutoEvalColumn.model.name],
|
| 111 |
-
interactive=False,
|
| 112 |
-
)
|
| 113 |
-
except Exception as e:
|
| 114 |
-
print(f"Error initializing leaderboard: {e}")
|
| 115 |
-
# Instead of showing error message, try simpler table display
|
| 116 |
-
return gr.Dataframe(
|
| 117 |
-
value=dataframe, headers=COLS, datatype=[c.type for c in fields(AutoEvalColumn)], interactive=False
|
| 118 |
-
)
|
| 119 |
|
| 120 |
|
| 121 |
demo = gr.Blocks(css=custom_css)
|
|
@@ -140,10 +127,9 @@ with demo:
|
|
| 140 |
label=CITATION_BUTTON_LABEL,
|
| 141 |
lines=20,
|
| 142 |
elem_id="citation-button",
|
| 143 |
-
show_copy_button=True,
|
| 144 |
)
|
| 145 |
|
| 146 |
scheduler = BackgroundScheduler()
|
| 147 |
scheduler.add_job(restart_space, "interval", seconds=1800)
|
| 148 |
scheduler.start()
|
| 149 |
-
demo.queue(default_concurrency_limit=40).launch(
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
from apscheduler.schedulers.background import BackgroundScheduler
|
| 4 |
from huggingface_hub import snapshot_download
|
|
|
|
| 85 |
if col == AutoEvalColumn.model.name:
|
| 86 |
# Keep model column as is since it contains HTML
|
| 87 |
continue
|
|
|
|
|
|
|
| 88 |
elif col in [AutoEvalColumn.seq_length.name, AutoEvalColumn.model_quantization_bits.name]:
|
| 89 |
dataframe[col] = dataframe[col].astype(int)
|
| 90 |
else:
|
|
|
|
| 94 |
except:
|
| 95 |
pass
|
| 96 |
|
| 97 |
+
# Select only columns that should be displayed by default
|
| 98 |
+
default_cols = [c.name for c in fields(AutoEvalColumn) if c.displayed_by_default]
|
| 99 |
+
display_df = dataframe[[c for c in default_cols if c in dataframe.columns]]
|
| 100 |
+
|
| 101 |
+
return gr.Dataframe(
|
| 102 |
+
value=display_df,
|
| 103 |
+
datatype=[c.type for c in fields(AutoEvalColumn) if c.name in display_df.columns],
|
| 104 |
+
interactive=False,
|
| 105 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
|
| 107 |
|
| 108 |
demo = gr.Blocks(css=custom_css)
|
|
|
|
| 127 |
label=CITATION_BUTTON_LABEL,
|
| 128 |
lines=20,
|
| 129 |
elem_id="citation-button",
|
|
|
|
| 130 |
)
|
| 131 |
|
| 132 |
scheduler = BackgroundScheduler()
|
| 133 |
scheduler.add_job(restart_space, "interval", seconds=1800)
|
| 134 |
scheduler.start()
|
| 135 |
+
demo.queue(default_concurrency_limit=40).launch()
|
requirements.txt
CHANGED
|
@@ -1,10 +1,6 @@
|
|
| 1 |
APScheduler
|
| 2 |
black
|
| 3 |
datasets
|
| 4 |
-
gradio
|
| 5 |
-
gradio[oauth]
|
| 6 |
-
gradio_leaderboard==0.0.9
|
| 7 |
-
gradio_client
|
| 8 |
huggingface-hub>=0.18.0
|
| 9 |
matplotlib
|
| 10 |
numpy
|
|
@@ -13,4 +9,4 @@ python-dateutil
|
|
| 13 |
tqdm
|
| 14 |
transformers
|
| 15 |
tokenizers>=0.15.0
|
| 16 |
-
sentencepiece
|
|
|
|
| 1 |
APScheduler
|
| 2 |
black
|
| 3 |
datasets
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
huggingface-hub>=0.18.0
|
| 5 |
matplotlib
|
| 6 |
numpy
|
|
|
|
| 9 |
tqdm
|
| 10 |
transformers
|
| 11 |
tokenizers>=0.15.0
|
| 12 |
+
sentencepiece
|
src/display/utils.py
CHANGED
|
@@ -13,7 +13,7 @@ def fields(raw_class):
|
|
| 13 |
# These classes are for user facing column names,
|
| 14 |
# to avoid having to change them all around the code
|
| 15 |
# when a modif is needed
|
| 16 |
-
@dataclass
|
| 17 |
class ColumnContent:
|
| 18 |
name: str
|
| 19 |
type: str
|
|
|
|
| 13 |
# These classes are for user facing column names,
|
| 14 |
# to avoid having to change them all around the code
|
| 15 |
# when a modif is needed
|
| 16 |
+
@dataclass(frozen=True)
|
| 17 |
class ColumnContent:
|
| 18 |
name: str
|
| 19 |
type: str
|