gradio-leaderboard 0.0.7__py3-none-any.whl → 0.0.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gradio_leaderboard/leaderboard.py +13 -0
- gradio_leaderboard/leaderboard.pyi +13 -0
- gradio_leaderboard/templates/component/index.js +727 -727
- {gradio_leaderboard-0.0.7.dist-info → gradio_leaderboard-0.0.8.dist-info}/METADATA +1 -1
- {gradio_leaderboard-0.0.7.dist-info → gradio_leaderboard-0.0.8.dist-info}/RECORD +6 -6
- {gradio_leaderboard-0.0.7.dist-info → gradio_leaderboard-0.0.8.dist-info}/WHEEL +0 -0
@@ -131,6 +131,8 @@ class Leaderboard(Component):
|
|
131
131
|
self.bool_checkboxgroup_label = bool_checkboxgroup_label
|
132
132
|
self.select_columns_config = self._get_select_columns(select_columns, value)
|
133
133
|
self.filter_columns = self._get_column_filter_configs(filter_columns, value)
|
134
|
+
self.raise_error_if_incorrect_config()
|
135
|
+
|
134
136
|
self.hide_columns = hide_columns or []
|
135
137
|
self.col_count = (len(self.headers), "fixed")
|
136
138
|
self.row_count = (value.shape[0], "fixed")
|
@@ -156,6 +158,17 @@ class Leaderboard(Component):
|
|
156
158
|
render=render,
|
157
159
|
value=value,
|
158
160
|
)
|
161
|
+
|
162
|
+
def raise_error_if_incorrect_config(self):
|
163
|
+
for col in [self.search_columns.primary_column, *self.search_columns.secondary_columns]:
|
164
|
+
if col not in self.headers:
|
165
|
+
raise ValueError(f"Column '{col}' not found in the DataFrame headers.")
|
166
|
+
for col in self.select_columns_config.default_selection + self.select_columns_config.cant_deselect:
|
167
|
+
if col not in self.headers:
|
168
|
+
raise ValueError(f"Column '{col}' not found in the DataFrame headers.")
|
169
|
+
for col in [col.column for col in self.filter_columns]:
|
170
|
+
if col not in self.headers:
|
171
|
+
raise ValueError(f"Column '{col}' not found in the DataFrame headers.")
|
159
172
|
|
160
173
|
@staticmethod
|
161
174
|
def _get_best_filter_type(
|
@@ -128,6 +128,8 @@ class Leaderboard(Component):
|
|
128
128
|
self.bool_checkboxgroup_label = bool_checkboxgroup_label
|
129
129
|
self.select_columns_config = self._get_select_columns(select_columns, value)
|
130
130
|
self.filter_columns = self._get_column_filter_configs(filter_columns, value)
|
131
|
+
self.raise_error_if_incorrect_config()
|
132
|
+
|
131
133
|
self.hide_columns = hide_columns or []
|
132
134
|
self.col_count = (len(self.headers), "fixed")
|
133
135
|
self.row_count = (value.shape[0], "fixed")
|
@@ -153,6 +155,17 @@ class Leaderboard(Component):
|
|
153
155
|
render=render,
|
154
156
|
value=value,
|
155
157
|
)
|
158
|
+
|
159
|
+
def raise_error_if_incorrect_config(self):
|
160
|
+
for col in [self.search_columns.primary_column, *self.search_columns.secondary_columns]:
|
161
|
+
if col not in self.headers:
|
162
|
+
raise ValueError(f"Column '{col}' not found in the DataFrame headers.")
|
163
|
+
for col in self.select_columns_config.default_selection + self.select_columns_config.cant_deselect:
|
164
|
+
if col not in self.headers:
|
165
|
+
raise ValueError(f"Column '{col}' not found in the DataFrame headers.")
|
166
|
+
for col in [col.column for col in self.filter_columns]:
|
167
|
+
if col not in self.headers:
|
168
|
+
raise ValueError(f"Column '{col}' not found in the DataFrame headers.")
|
156
169
|
|
157
170
|
@staticmethod
|
158
171
|
def _get_best_filter_type(
|