Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update docs.md
Browse files
docs.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# gradio_leaderboard
|
3 |
|
4 |
## πβ‘οΈπ₯ Super fast, batteries included Leaderboards with minimal code.
|
5 |
-
<img alt="Static Badge" src="https://img.shields.io/badge/version%20-%200.0.
|
6 |
|
7 |
|
8 |
The `gradio_leaderboard` package helps you build fully functional and performant leaderboard demos with `gradio`.
|
@@ -137,9 +137,12 @@ This will display a series of form elements that users can use to select/deselec
|
|
137 |
This parameter must be a `list` but it's elements must be:
|
138 |
|
139 |
* `a string`: Corresponding to the column name you'd like to add a filter for
|
140 |
-
* `a ColumnFilter`: A special class for full control of the filter's type, e.g. `checkboxgroup`, `slider`, or `dropdown`, as well as it's appearance in the UI.
|
141 |
|
142 |
-
If the `type` of the `ColumnFilter` is not specified, a heuristic will be used to choose the most appropriate type. If the data in the column is numeric, a slider will be used.
|
|
|
|
|
|
|
143 |
|
144 |
|
145 |
#### Demo
|
@@ -152,18 +155,22 @@ from gradio_leaderboard import Leaderboard, ColumnFilter
|
|
152 |
with gr.Blocks() as demo:
|
153 |
Leaderboard(
|
154 |
value=pd.DataFrame({"name": ["Freddy", "Maria", "Mark"], "country": ["USA", "Mexico", "USA"],
|
155 |
-
"age": [25, 30, 35], "score": [100, 200, 300]
|
|
|
156 |
filter_columns=[
|
157 |
"name",
|
158 |
ColumnFilter("country", type="dropdown", label="Select Country πΊπΈπ²π½"),
|
159 |
-
ColumnFilter("age", type="slider", min=20, max=40
|
160 |
-
ColumnFilter("score", type="slider", min=50, max=350
|
|
|
|
|
161 |
)
|
162 |
|
163 |
demo.launch()
|
164 |
```
|
165 |
|
166 |
-
![
|
|
|
167 |
|
168 |
## `Leaderboard`
|
169 |
|
@@ -244,6 +251,19 @@ list[str | ColumnFilter] | None
|
|
244 |
<td align="left">See Configuration section of docs for details.</td>
|
245 |
</tr>
|
246 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
<tr>
|
248 |
<td align="left"><code>hide_columns</code></td>
|
249 |
<td align="left" style="width: 25%;">
|
|
|
2 |
# gradio_leaderboard
|
3 |
|
4 |
## πβ‘οΈπ₯ Super fast, batteries included Leaderboards with minimal code.
|
5 |
+
<img alt="Static Badge" src="https://img.shields.io/badge/version%20-%200.0.3%20-%20orange">
|
6 |
|
7 |
|
8 |
The `gradio_leaderboard` package helps you build fully functional and performant leaderboard demos with `gradio`.
|
|
|
137 |
This parameter must be a `list` but it's elements must be:
|
138 |
|
139 |
* `a string`: Corresponding to the column name you'd like to add a filter for
|
140 |
+
* `a ColumnFilter`: A special class for full control of the filter's type, e.g. `checkboxgroup`, `boolean`, `slider`, or `dropdown`, as well as it's appearance in the UI.
|
141 |
|
142 |
+
If the `type` of the `ColumnFilter` is not specified, a heuristic will be used to choose the most appropriate type. If the data in the column is boolean-valued, a `boolean` type will be used. If it is numeric, a slider will be used. For all others, a `checkboxgroup` will be used.
|
143 |
+
|
144 |
+
All `ColumnFilters` of type `boolean` will be displayed together in a checkbox group. When a `checkbox` in that group is selected, only those rows that have a true value for that column will be displayed. When it is deselected, the table will not be filtered by that column.
|
145 |
+
You can add a label to the `boolean` `checkboxgroup` with the `bool_checkboxgroup_label` parameter.
|
146 |
|
147 |
|
148 |
#### Demo
|
|
|
155 |
with gr.Blocks() as demo:
|
156 |
Leaderboard(
|
157 |
value=pd.DataFrame({"name": ["Freddy", "Maria", "Mark"], "country": ["USA", "Mexico", "USA"],
|
158 |
+
"age": [25, 30, 35], "score": [100, 200, 300],
|
159 |
+
"registered": [True, False, True]}),
|
160 |
filter_columns=[
|
161 |
"name",
|
162 |
ColumnFilter("country", type="dropdown", label="Select Country πΊπΈπ²π½"),
|
163 |
+
ColumnFilter("age", type="slider", min=20, max=40),
|
164 |
+
ColumnFilter("score", type="slider", min=50, max=350),
|
165 |
+
"registered"],
|
166 |
+
bool_checkboxgroup_label="Only show registered"
|
167 |
)
|
168 |
|
169 |
demo.launch()
|
170 |
```
|
171 |
|
172 |
+
![filter_columns_gif](https://github.com/freddyaboulton/gradio-leaderboard/assets/41651716/07dc39a5-687c-414b-b96e-777fd01ebe00)
|
173 |
+
|
174 |
|
175 |
## `Leaderboard`
|
176 |
|
|
|
251 |
<td align="left">See Configuration section of docs for details.</td>
|
252 |
</tr>
|
253 |
|
254 |
+
<tr>
|
255 |
+
<td align="left"><code>bool_checkboxgroup_label</code></td>
|
256 |
+
<td align="left" style="width: 25%;">
|
257 |
+
|
258 |
+
```python
|
259 |
+
str | None
|
260 |
+
```
|
261 |
+
|
262 |
+
</td>
|
263 |
+
<td align="left"><code>None</code></td>
|
264 |
+
<td align="left">Label for the checkboxgroup filter for boolean columns.</td>
|
265 |
+
</tr>
|
266 |
+
|
267 |
<tr>
|
268 |
<td align="left"><code>hide_columns</code></td>
|
269 |
<td align="left" style="width: 25%;">
|