Spaces:
Sleeping
Sleeping
Add toggle switch, compact layout, sync nav labels
Browse files- app.py +9 -6
- src/about.py +38 -1
app.py
CHANGED
|
@@ -166,12 +166,14 @@ with gr.Blocks(css=custom_css, title="PhotoBench-Protected Leaderboard") as demo
|
|
| 166 |
# === Tab 1: Leaderboard ===
|
| 167 |
with gr.TabItem("π
Leaderboard"):
|
| 168 |
with gr.Row():
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
|
|
|
|
|
|
| 175 |
leaderboard_table = gr.DataFrame(
|
| 176 |
label="Top 30",
|
| 177 |
interactive=False,
|
|
@@ -214,6 +216,7 @@ with gr.Blocks(css=custom_css, title="PhotoBench-Protected Leaderboard") as demo
|
|
| 214 |
opt_in_toggle = gr.Checkbox(
|
| 215 |
label="Publish to public leaderboard",
|
| 216 |
value=True,
|
|
|
|
| 217 |
)
|
| 218 |
submit_btn = gr.Button("Submit for Evaluation", variant="primary")
|
| 219 |
|
|
|
|
| 166 |
# === Tab 1: Leaderboard ===
|
| 167 |
with gr.TabItem("π
Leaderboard"):
|
| 168 |
with gr.Row():
|
| 169 |
+
with gr.Column(scale=3):
|
| 170 |
+
sort_by = gr.Dropdown(
|
| 171 |
+
choices=ALL_METRIC_COLS,
|
| 172 |
+
value="Recall@10",
|
| 173 |
+
label="Sort by",
|
| 174 |
+
)
|
| 175 |
+
with gr.Column(scale=1):
|
| 176 |
+
refresh_btn = gr.Button("Refresh", variant="primary")
|
| 177 |
leaderboard_table = gr.DataFrame(
|
| 178 |
label="Top 30",
|
| 179 |
interactive=False,
|
|
|
|
| 216 |
opt_in_toggle = gr.Checkbox(
|
| 217 |
label="Publish to public leaderboard",
|
| 218 |
value=True,
|
| 219 |
+
elem_classes=["toggle-switch"],
|
| 220 |
)
|
| 221 |
submit_btn = gr.Button("Submit for Evaluation", variant="primary")
|
| 222 |
|
src/about.py
CHANGED
|
@@ -11,7 +11,7 @@ NAVIGATION = """
|
|
| 11 |
<span style="display:inline-block; padding:8px 14px; background:#fff; border:1px solid #d4e0c8; border-radius:10px; color:#555; font-size:0.85em; font-weight:500;">π
Leaderboard</span>
|
| 12 |
</a>
|
| 13 |
<a href="https://huggingface.co/datasets/SorrowTea/PhotoBench" target="_blank" style="text-decoration:none;">
|
| 14 |
-
<span style="display:inline-block; padding:8px 14px; background:#fff; border:1px solid #d4e0c8; border-radius:10px; color:#555; font-size:0.85em; font-weight:500;">
|
| 15 |
</a>
|
| 16 |
<span style="display:inline-block; padding:8px 14px; background:#7CB342; border:1px solid #7CB342; border-radius:10px; color:#fff; font-size:0.85em; font-weight:600;">π‘οΈ Protected Leaderboard</span>
|
| 17 |
<a href="https://huggingface.co/datasets/SorrowTea/PhotoBench-Protected" target="_blank" style="text-decoration:none;">
|
|
@@ -232,4 +232,41 @@ input:focus, textarea:focus, select:focus {
|
|
| 232 |
margin-top: 24px;
|
| 233 |
margin-bottom: 12px;
|
| 234 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 235 |
"""
|
|
|
|
| 11 |
<span style="display:inline-block; padding:8px 14px; background:#fff; border:1px solid #d4e0c8; border-radius:10px; color:#555; font-size:0.85em; font-weight:500;">π
Leaderboard</span>
|
| 12 |
</a>
|
| 13 |
<a href="https://huggingface.co/datasets/SorrowTea/PhotoBench" target="_blank" style="text-decoration:none;">
|
| 14 |
+
<span style="display:inline-block; padding:8px 14px; background:#fff; border:1px solid #d4e0c8; border-radius:10px; color:#555; font-size:0.85em; font-weight:500;">π¦ Dataset</span>
|
| 15 |
</a>
|
| 16 |
<span style="display:inline-block; padding:8px 14px; background:#7CB342; border:1px solid #7CB342; border-radius:10px; color:#fff; font-size:0.85em; font-weight:600;">π‘οΈ Protected Leaderboard</span>
|
| 17 |
<a href="https://huggingface.co/datasets/SorrowTea/PhotoBench-Protected" target="_blank" style="text-decoration:none;">
|
|
|
|
| 232 |
margin-top: 24px;
|
| 233 |
margin-bottom: 12px;
|
| 234 |
}
|
| 235 |
+
|
| 236 |
+
/* Toggle switch for opt-in checkbox */
|
| 237 |
+
.toggle-switch input[type="checkbox"] {
|
| 238 |
+
appearance: none !important;
|
| 239 |
+
-webkit-appearance: none !important;
|
| 240 |
+
width: 44px !important;
|
| 241 |
+
height: 24px !important;
|
| 242 |
+
background: #ccc !important;
|
| 243 |
+
border-radius: 12px !important;
|
| 244 |
+
position: relative !important;
|
| 245 |
+
cursor: pointer !important;
|
| 246 |
+
outline: none !important;
|
| 247 |
+
transition: background 0.3s ease !important;
|
| 248 |
+
flex-shrink: 0 !important;
|
| 249 |
+
vertical-align: middle !important;
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
.toggle-switch input[type="checkbox"]::after {
|
| 253 |
+
content: '' !important;
|
| 254 |
+
position: absolute !important;
|
| 255 |
+
width: 20px !important;
|
| 256 |
+
height: 20px !important;
|
| 257 |
+
background: white !important;
|
| 258 |
+
border-radius: 50% !important;
|
| 259 |
+
top: 2px !important;
|
| 260 |
+
left: 2px !important;
|
| 261 |
+
transition: transform 0.3s ease !important;
|
| 262 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
.toggle-switch input[type="checkbox"]:checked {
|
| 266 |
+
background: #7CB342 !important;
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
.toggle-switch input[type="checkbox"]:checked::after {
|
| 270 |
+
transform: translateX(20px) !important;
|
| 271 |
+
}
|
| 272 |
"""
|