Spaces:
Running
Running
Sonja Topf
commited on
Commit
·
0642ebc
1
Parent(s):
0aacfc1
submission button and checkbox to radio
Browse files- config/leaderboard.py +2 -2
- frontend/content.py +1 -0
- frontend/layout.py +37 -23
- frontend/leaderboard.py +9 -4
- frontend/styles.css +34 -21
config/leaderboard.py
CHANGED
|
@@ -18,7 +18,7 @@ METADATA_COLUMN_NAMES = [
|
|
| 18 |
"Zero-shot (y/n)",
|
| 19 |
"N-shot", # only if few-shot is yes
|
| 20 |
"Few-shot (y/n)",
|
| 21 |
-
"ΔAUC-PR",
|
| 22 |
"Organization",
|
| 23 |
"Publication Link",
|
| 24 |
"Pretraining Data", # only if Pretrained (y/n) is yes
|
|
@@ -39,7 +39,7 @@ METADATA_COLUMN_WIDTHS = {
|
|
| 39 |
"Zero-shot (y/n)": 140,
|
| 40 |
"N-shot": 140,
|
| 41 |
"Few-shot (y/n)": 140,
|
| 42 |
-
"ΔAUC-PR": 130,
|
| 43 |
"Organization": 200,
|
| 44 |
"Pretraining Data": 100,
|
| 45 |
"Publication Link": 400
|
|
|
|
| 18 |
"Zero-shot (y/n)",
|
| 19 |
"N-shot", # only if few-shot is yes
|
| 20 |
"Few-shot (y/n)",
|
| 21 |
+
"Avg. ΔAUC-PR",
|
| 22 |
"Organization",
|
| 23 |
"Publication Link",
|
| 24 |
"Pretraining Data", # only if Pretrained (y/n) is yes
|
|
|
|
| 39 |
"Zero-shot (y/n)": 140,
|
| 40 |
"N-shot": 140,
|
| 41 |
"Few-shot (y/n)": 140,
|
| 42 |
+
"Avg. ΔAUC-PR": 130,
|
| 43 |
"Organization": 200,
|
| 44 |
"Pretraining Data": 100,
|
| 45 |
"Publication Link": 400
|
frontend/content.py
CHANGED
|
@@ -34,6 +34,7 @@ class LeaderboardContent:
|
|
| 34 |
return """
|
| 35 |
<div class="info-section">
|
| 36 |
<div><strong>Avg. AUC</strong>: Mean ROC-AUC across all 12 tasks</div>
|
|
|
|
| 37 |
<div><strong>Rank</strong>: based on Avg. AUC</div>
|
| 38 |
</div>
|
| 39 |
"""
|
|
|
|
| 34 |
return """
|
| 35 |
<div class="info-section">
|
| 36 |
<div><strong>Avg. AUC</strong>: Mean ROC-AUC across all 12 tasks</div>
|
| 37 |
+
<div><strong>Avg. ΔAUC-PR</strong>: Mean ΔAUC-PR across all 12 tasks</div>
|
| 38 |
<div><strong>Rank</strong>: based on Avg. AUC</div>
|
| 39 |
</div>
|
| 40 |
"""
|
frontend/layout.py
CHANGED
|
@@ -235,31 +235,37 @@ def create_submission_tab(submit_callback: Callable = None) -> gr.TabItem:
|
|
| 235 |
elem_classes=["form-container"]
|
| 236 |
)
|
| 237 |
|
| 238 |
-
pretrained =
|
| 239 |
-
|
|
|
|
|
|
|
| 240 |
container=False,
|
| 241 |
-
elem_classes=["form-container-
|
| 242 |
)
|
| 243 |
|
| 244 |
pretraining_label = gr.HTML(f"<div>{SubmissionContent.form_labels['pretraining_data']}</div>", container=False,
|
| 245 |
-
elem_classes=["field-label"], visible=
|
| 246 |
pretraining_data = gr.Textbox(
|
| 247 |
label=SubmissionContent.form_labels["pretraining_data"],
|
| 248 |
placeholder=SubmissionContent.form_placeholders[
|
| 249 |
"pretraining_data"
|
| 250 |
],
|
| 251 |
-
visible=
|
| 252 |
container=False,
|
| 253 |
max_lines=1,
|
| 254 |
elem_classes=["form-container"]
|
| 255 |
)
|
| 256 |
|
| 257 |
# When checkbox changes, update visibility
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 258 |
pretrained.change(
|
| 259 |
-
fn=
|
| 260 |
-
gr.update(visible=checked),
|
| 261 |
-
gr.update(visible=checked),
|
| 262 |
-
],
|
| 263 |
inputs=pretrained,
|
| 264 |
outputs=[pretraining_label, pretraining_data],
|
| 265 |
)
|
|
@@ -294,37 +300,45 @@ def create_submission_tab(submit_callback: Callable = None) -> gr.TabItem:
|
|
| 294 |
elem_classes=["form-container"]
|
| 295 |
)
|
| 296 |
|
| 297 |
-
zero_shot =
|
| 298 |
-
|
|
|
|
|
|
|
| 299 |
container=False,
|
| 300 |
-
elem_classes=["form-container-
|
| 301 |
)
|
| 302 |
|
| 303 |
-
|
| 304 |
-
few_shot = gr.
|
| 305 |
-
|
|
|
|
| 306 |
container=False,
|
| 307 |
-
elem_classes=["form-container-
|
| 308 |
)
|
| 309 |
|
| 310 |
n_shot_label = gr.HTML(f"<div>{SubmissionContent.form_labels['n_shot']}</div>",
|
| 311 |
-
container=False, elem_classes=["field-label"], visible=
|
| 312 |
n_shot = gr.Textbox(
|
| 313 |
label=SubmissionContent.form_labels["n_shot"],
|
| 314 |
placeholder=SubmissionContent.form_placeholders[
|
| 315 |
"n_shot"
|
| 316 |
],
|
| 317 |
-
visible=
|
| 318 |
container=False,
|
| 319 |
max_lines=1,
|
| 320 |
elem_classes=["form-container"]
|
| 321 |
)
|
| 322 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 323 |
few_shot.change(
|
| 324 |
-
fn=
|
| 325 |
-
gr.update(visible=checked),
|
| 326 |
-
gr.update(visible=checked),
|
| 327 |
-
],
|
| 328 |
inputs=few_shot,
|
| 329 |
outputs=[n_shot_label, n_shot],
|
| 330 |
)
|
|
@@ -336,7 +350,7 @@ def create_submission_tab(submit_callback: Callable = None) -> gr.TabItem:
|
|
| 336 |
|
| 337 |
|
| 338 |
# Submit button and result
|
| 339 |
-
submit_btn = gr.Button("Submit", value="primary", interactive=False, elem_classes=["submit-button"
|
| 340 |
agree.change(lambda x: gr.update(interactive=x), inputs=agree, outputs=submit_btn)
|
| 341 |
result_msg = gr.HTML()
|
| 342 |
|
|
|
|
| 235 |
elem_classes=["form-container"]
|
| 236 |
)
|
| 237 |
|
| 238 |
+
gr.HTML(f"<div>{SubmissionContent.form_labels['pretrained']}</div>", container=False, elem_classes=["field-label"])
|
| 239 |
+
pretrained = gr.Radio(
|
| 240 |
+
choices=["Yes", "No"],
|
| 241 |
+
value="No",
|
| 242 |
container=False,
|
| 243 |
+
elem_classes=["form-container-radio"]
|
| 244 |
)
|
| 245 |
|
| 246 |
pretraining_label = gr.HTML(f"<div>{SubmissionContent.form_labels['pretraining_data']}</div>", container=False,
|
| 247 |
+
elem_classes=["field-label"], visible=False)
|
| 248 |
pretraining_data = gr.Textbox(
|
| 249 |
label=SubmissionContent.form_labels["pretraining_data"],
|
| 250 |
placeholder=SubmissionContent.form_placeholders[
|
| 251 |
"pretraining_data"
|
| 252 |
],
|
| 253 |
+
visible=False,
|
| 254 |
container=False,
|
| 255 |
max_lines=1,
|
| 256 |
elem_classes=["form-container"]
|
| 257 |
)
|
| 258 |
|
| 259 |
# When checkbox changes, update visibility
|
| 260 |
+
def toggle_pretrain_fields(choice):
|
| 261 |
+
show = (choice == "Yes")
|
| 262 |
+
return [
|
| 263 |
+
gr.update(visible=show),
|
| 264 |
+
gr.update(visible=show)
|
| 265 |
+
]
|
| 266 |
+
|
| 267 |
pretrained.change(
|
| 268 |
+
fn=toggle_pretrain_fields,
|
|
|
|
|
|
|
|
|
|
| 269 |
inputs=pretrained,
|
| 270 |
outputs=[pretraining_label, pretraining_data],
|
| 271 |
)
|
|
|
|
| 300 |
elem_classes=["form-container"]
|
| 301 |
)
|
| 302 |
|
| 303 |
+
gr.HTML(f"<div>{SubmissionContent.form_labels['zero_shot']}</div>", container=False, elem_classes=["field-label"])
|
| 304 |
+
zero_shot = gr.Radio(
|
| 305 |
+
choices=["Yes", "No"],
|
| 306 |
+
value="No",
|
| 307 |
container=False,
|
| 308 |
+
elem_classes=["form-container-radio"]
|
| 309 |
)
|
| 310 |
|
| 311 |
+
gr.HTML(f"<div>{SubmissionContent.form_labels['few_shot']}</div>", container=False, elem_classes=["field-label"])
|
| 312 |
+
few_shot = gr.Radio(
|
| 313 |
+
choices=["Yes", "No"],
|
| 314 |
+
value="No",
|
| 315 |
container=False,
|
| 316 |
+
elem_classes=["form-container-radio"]
|
| 317 |
)
|
| 318 |
|
| 319 |
n_shot_label = gr.HTML(f"<div>{SubmissionContent.form_labels['n_shot']}</div>",
|
| 320 |
+
container=False, elem_classes=["field-label"], visible=False)
|
| 321 |
n_shot = gr.Textbox(
|
| 322 |
label=SubmissionContent.form_labels["n_shot"],
|
| 323 |
placeholder=SubmissionContent.form_placeholders[
|
| 324 |
"n_shot"
|
| 325 |
],
|
| 326 |
+
visible=False,
|
| 327 |
container=False,
|
| 328 |
max_lines=1,
|
| 329 |
elem_classes=["form-container"]
|
| 330 |
)
|
| 331 |
|
| 332 |
+
|
| 333 |
+
def toggle_n_shot_fields(choice):
|
| 334 |
+
show = (choice == "Yes")
|
| 335 |
+
return [
|
| 336 |
+
gr.update(visible=show),
|
| 337 |
+
gr.update(visible=show)
|
| 338 |
+
]
|
| 339 |
+
|
| 340 |
few_shot.change(
|
| 341 |
+
fn=toggle_n_shot_fields,
|
|
|
|
|
|
|
|
|
|
| 342 |
inputs=few_shot,
|
| 343 |
outputs=[n_shot_label, n_shot],
|
| 344 |
)
|
|
|
|
| 350 |
|
| 351 |
|
| 352 |
# Submit button and result
|
| 353 |
+
submit_btn = gr.Button("Submit", value="primary", interactive=False, elem_classes=["submit-button"])
|
| 354 |
agree.change(lambda x: gr.update(interactive=x), inputs=agree, outputs=submit_btn)
|
| 355 |
result_msg = gr.HTML()
|
| 356 |
|
frontend/leaderboard.py
CHANGED
|
@@ -56,7 +56,7 @@ def format_leaderboard_data(raw_data: dict) -> pd.DataFrame:
|
|
| 56 |
("", "Model"): config["model_name"],
|
| 57 |
("", "Organization"): config.get("organization", ""),
|
| 58 |
("", "Avg. AUC"): results["overall_score"]["roc_auc"],
|
| 59 |
-
("", "ΔAUC-PR"): results["overall_score"].get("delta_auprc"),
|
| 60 |
}
|
| 61 |
print(results["overall_score"])
|
| 62 |
|
|
@@ -82,15 +82,20 @@ def format_leaderboard_data(raw_data: dict) -> pd.DataFrame:
|
|
| 82 |
# "N-shot": config.get("n_shot", ""),
|
| 83 |
# })
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
row.update({
|
| 86 |
("", "Model Description"): config["model_description"],
|
| 87 |
("", "Publication"): config.get("publication_title", ""),
|
| 88 |
("", "Publication Link"): config.get("publication_link", ""),
|
| 89 |
("", "# Parameters"): config.get("model_size", ""),
|
| 90 |
-
("", "Pretrained
|
| 91 |
("", "Pretraining Data"): config.get("pretraining_data", ""),
|
| 92 |
-
("", "Zero-shot
|
| 93 |
-
("", "Few-shot
|
| 94 |
("", "N-shot"): config.get("n_shot", ""),
|
| 95 |
})
|
| 96 |
|
|
|
|
| 56 |
("", "Model"): config["model_name"],
|
| 57 |
("", "Organization"): config.get("organization", ""),
|
| 58 |
("", "Avg. AUC"): results["overall_score"]["roc_auc"],
|
| 59 |
+
("", "Avg. ΔAUC-PR"): results["overall_score"].get("delta_auprc"),
|
| 60 |
}
|
| 61 |
print(results["overall_score"])
|
| 62 |
|
|
|
|
| 82 |
# "N-shot": config.get("n_shot", ""),
|
| 83 |
# })
|
| 84 |
|
| 85 |
+
# store as boolean
|
| 86 |
+
pretrained = config.get("pretrained", "")=="Yes"
|
| 87 |
+
zero_shot = config.get("zero_shot", "")=="Yes"
|
| 88 |
+
few_shot = config.get("few_shot", "")=="Yes"
|
| 89 |
+
|
| 90 |
row.update({
|
| 91 |
("", "Model Description"): config["model_description"],
|
| 92 |
("", "Publication"): config.get("publication_title", ""),
|
| 93 |
("", "Publication Link"): config.get("publication_link", ""),
|
| 94 |
("", "# Parameters"): config.get("model_size", ""),
|
| 95 |
+
("", "Pretrained"): pretrained,
|
| 96 |
("", "Pretraining Data"): config.get("pretraining_data", ""),
|
| 97 |
+
("", "Zero-shot"): zero_shot,
|
| 98 |
+
("", "Few-shot"): few_shot,
|
| 99 |
("", "N-shot"): config.get("n_shot", ""),
|
| 100 |
})
|
| 101 |
|
frontend/styles.css
CHANGED
|
@@ -49,6 +49,7 @@ body, .gradio-container {
|
|
| 49 |
|
| 50 |
|
| 51 |
|
|
|
|
| 52 |
/* === Container === */
|
| 53 |
.leaderboard-container {
|
| 54 |
overflow: auto;
|
|
@@ -313,7 +314,7 @@ body, .gradio-container {
|
|
| 313 |
align-items: center;
|
| 314 |
gap: 8px; /* space between checkbox and text */
|
| 315 |
padding: 8px 10px;
|
| 316 |
-
margin-top:
|
| 317 |
margin-bottom: 5px !important;
|
| 318 |
font-size: 14px !important;
|
| 319 |
font-weight: 500;
|
|
@@ -337,6 +338,20 @@ body, .gradio-container {
|
|
| 337 |
border-color: #d1d5db;
|
| 338 |
}
|
| 339 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 340 |
|
| 341 |
|
| 342 |
|
|
@@ -346,55 +361,53 @@ body, .gradio-container {
|
|
| 346 |
|
| 347 |
|
| 348 |
/* === Submit Button === */
|
| 349 |
-
.submit-button {
|
| 350 |
-
|
| 351 |
-
background-color: #ACCBE1 !important; /* indigo base */
|
| 352 |
color: #fff !important;
|
| 353 |
border: none !important;
|
| 354 |
border-radius: 8px !important;
|
| 355 |
-
padding:
|
| 356 |
font-size: 15px !important;
|
| 357 |
font-weight: 600 !important;
|
| 358 |
cursor: pointer !important;
|
| 359 |
-
|
| 360 |
-
width:100%;
|
| 361 |
-
|
| 362 |
-
/* Fix weird float / alignment */
|
| 363 |
align-self: flex-start !important; /* ✅ anchors left within flex parent */
|
| 364 |
margin-top: 16px !important; /* ✅ small top gap */
|
| 365 |
-
margin-
|
| 366 |
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
|
| 367 |
}
|
| 368 |
|
| 369 |
/* === Hover state === */
|
| 370 |
.submit-button:hover:not(:disabled) {
|
| 371 |
-
background-color: #
|
| 372 |
box-shadow: 0 4px 10px rgba(99, 102, 241, 0.35) !important;
|
| 373 |
transform: translateY(-1px);
|
| 374 |
}
|
| 375 |
|
| 376 |
/* === Active (pressed) state === */
|
| 377 |
.submit-button:active:not(:disabled) {
|
| 378 |
-
background-color: #
|
| 379 |
transform: scale(0.98);
|
| 380 |
box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25) !important;
|
| 381 |
}
|
| 382 |
|
| 383 |
/* === Disabled state === */
|
| 384 |
.submit-button:disabled {
|
| 385 |
-
background-color: #
|
| 386 |
-
color: #
|
| 387 |
cursor: not-allowed !important;
|
| 388 |
box-shadow: none !important;
|
| 389 |
opacity: 0.75 !important;
|
| 390 |
transform: none !important;
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
|
|
|
|
|
|
| 398 |
}
|
| 399 |
|
| 400 |
|
|
|
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
+
|
| 53 |
/* === Container === */
|
| 54 |
.leaderboard-container {
|
| 55 |
overflow: auto;
|
|
|
|
| 314 |
align-items: center;
|
| 315 |
gap: 8px; /* space between checkbox and text */
|
| 316 |
padding: 8px 10px;
|
| 317 |
+
margin-top: 15px !important;
|
| 318 |
margin-bottom: 5px !important;
|
| 319 |
font-size: 14px !important;
|
| 320 |
font-weight: 500;
|
|
|
|
| 338 |
border-color: #d1d5db;
|
| 339 |
}
|
| 340 |
|
| 341 |
+
.form-container-radio {
|
| 342 |
+
display: flex; /* ✅ aligns checkbox + label nicely */
|
| 343 |
+
align-items: center;
|
| 344 |
+
gap: 8px; /* space between checkbox and text */
|
| 345 |
+
padding: 8px 10px;
|
| 346 |
+
margin-top: 5px !important;
|
| 347 |
+
margin-bottom: 5px !important;
|
| 348 |
+
font-size: 14px !important;
|
| 349 |
+
font-weight: 500;
|
| 350 |
+
width: 100%;
|
| 351 |
+
background: transparent !important;
|
| 352 |
+
border: none !important;
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
|
| 356 |
|
| 357 |
|
|
|
|
| 361 |
|
| 362 |
|
| 363 |
/* === Submit Button === */
|
| 364 |
+
.submit-button:not(:disabled) {
|
| 365 |
+
background-color: #E67F0D !important;
|
|
|
|
| 366 |
color: #fff !important;
|
| 367 |
border: none !important;
|
| 368 |
border-radius: 8px !important;
|
| 369 |
+
padding: 10px 50px !important;
|
| 370 |
font-size: 15px !important;
|
| 371 |
font-weight: 600 !important;
|
| 372 |
cursor: pointer !important;
|
| 373 |
+
width:fit-content;
|
|
|
|
|
|
|
|
|
|
| 374 |
align-self: flex-start !important; /* ✅ anchors left within flex parent */
|
| 375 |
margin-top: 16px !important; /* ✅ small top gap */
|
| 376 |
+
margin-left: 0 !important;
|
| 377 |
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
|
| 378 |
}
|
| 379 |
|
| 380 |
/* === Hover state === */
|
| 381 |
.submit-button:hover:not(:disabled) {
|
| 382 |
+
background-color: #FE4E00 !important; /* darker indigo */
|
| 383 |
box-shadow: 0 4px 10px rgba(99, 102, 241, 0.35) !important;
|
| 384 |
transform: translateY(-1px);
|
| 385 |
}
|
| 386 |
|
| 387 |
/* === Active (pressed) state === */
|
| 388 |
.submit-button:active:not(:disabled) {
|
| 389 |
+
background-color: #FE4E00 !important;
|
| 390 |
transform: scale(0.98);
|
| 391 |
box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25) !important;
|
| 392 |
}
|
| 393 |
|
| 394 |
/* === Disabled state === */
|
| 395 |
.submit-button:disabled {
|
| 396 |
+
background-color: #9CA3AF !important; /* Light gray */
|
| 397 |
+
color: #4B5563 !important; /* Muted gray text */
|
| 398 |
cursor: not-allowed !important;
|
| 399 |
box-shadow: none !important;
|
| 400 |
opacity: 0.75 !important;
|
| 401 |
transform: none !important;
|
| 402 |
+
padding: 10px 50px !important;
|
| 403 |
+
width:fit-content;
|
| 404 |
+
align-self: flex-start !important;
|
| 405 |
+
margin-left: 0 !important;
|
| 406 |
+
margin-top: 16px;
|
| 407 |
+
font-size: 15px !important;
|
| 408 |
+
font-weight: 600 !important;
|
| 409 |
+
border: none !important;
|
| 410 |
+
border-radius: 8px !important;
|
| 411 |
}
|
| 412 |
|
| 413 |
|