Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -343,23 +343,29 @@ with block:
|
|
| 343 |
# 2οΈβ£ Visualisation tab
|
| 344 |
# ------------------------------------------------------------------
|
| 345 |
with gr.TabItem("π Visualization", elem_id="probe-benchmark-tab-visualization", id=2):
|
|
|
|
| 346 |
gr.Markdown(
|
| 347 |
"""## **Interactive Visualizations**
|
| 348 |
-
Choose a benchmark type; context
|
| 349 |
elem_classes="markdown-text",
|
| 350 |
)
|
|
|
|
|
|
|
| 351 |
vis_benchmark_type_selector = gr.Dropdown(
|
| 352 |
choices=list(benchmark_specific_metrics.keys()),
|
| 353 |
label="π§ͺ Benchmark Type",
|
| 354 |
value=None,
|
| 355 |
)
|
|
|
|
|
|
|
| 356 |
with gr.Row():
|
| 357 |
-
vis_x_metric_selector
|
| 358 |
-
vis_y_metric_selector
|
| 359 |
-
vis_aspect_type_selector
|
| 360 |
-
vis_dataset_selector
|
| 361 |
-
vis_single_metric_selector = gr.Dropdown(choices=[], label="Metric",
|
| 362 |
-
|
|
|
|
| 363 |
base_method_names = [m for m in method_names if m in base_methods]
|
| 364 |
user_method_names = [m for m in method_names if m not in base_methods]
|
| 365 |
|
|
@@ -379,14 +385,15 @@ with block:
|
|
| 379 |
interactive=True,
|
| 380 |
)
|
| 381 |
|
|
|
|
| 382 |
plot_button = gr.Button("Plot")
|
|
|
|
| 383 |
with gr.Row(show_progress=True, variant='panel'):
|
| 384 |
plot_output = gr.Image(label="Plot")
|
| 385 |
-
|
| 386 |
gr.Markdown("#### If a method name ends with **^**, it suggests potential suspicions of data leakage related to ***similarity***, ***function***, or ***family*** benchmarks.")
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
# callbacks
|
| 390 |
vis_benchmark_type_selector.change(
|
| 391 |
update_metric_choices,
|
| 392 |
inputs=[vis_benchmark_type_selector],
|
|
@@ -398,11 +405,18 @@ with block:
|
|
| 398 |
vis_single_metric_selector,
|
| 399 |
],
|
| 400 |
)
|
|
|
|
|
|
|
| 401 |
plot_button.click(
|
| 402 |
-
generate_plot
|
|
|
|
|
|
|
|
|
|
|
|
|
| 403 |
inputs=[
|
| 404 |
vis_benchmark_type_selector,
|
| 405 |
-
|
|
|
|
| 406 |
vis_x_metric_selector,
|
| 407 |
vis_y_metric_selector,
|
| 408 |
vis_aspect_type_selector,
|
|
|
|
| 343 |
# 2οΈβ£ Visualisation tab
|
| 344 |
# ------------------------------------------------------------------
|
| 345 |
with gr.TabItem("π Visualization", elem_id="probe-benchmark-tab-visualization", id=2):
|
| 346 |
+
|
| 347 |
gr.Markdown(
|
| 348 |
"""## **Interactive Visualizations**
|
| 349 |
+
Choose a benchmark type; context-specific options will appear.""",
|
| 350 |
elem_classes="markdown-text",
|
| 351 |
)
|
| 352 |
+
|
| 353 |
+
# ββ benchmark-type selector ββββββββββββββββββββββββββββββββββ
|
| 354 |
vis_benchmark_type_selector = gr.Dropdown(
|
| 355 |
choices=list(benchmark_specific_metrics.keys()),
|
| 356 |
label="π§ͺ Benchmark Type",
|
| 357 |
value=None,
|
| 358 |
)
|
| 359 |
+
|
| 360 |
+
# ββ metric / dataset selectors (appear contextually) βββββββββ
|
| 361 |
with gr.Row():
|
| 362 |
+
vis_x_metric_selector = gr.Dropdown(choices=[], label="X-axis Metric", visible=False)
|
| 363 |
+
vis_y_metric_selector = gr.Dropdown(choices=[], label="Y-axis Metric", visible=False)
|
| 364 |
+
vis_aspect_type_selector = gr.Dropdown(choices=[], label="Aspect", visible=False)
|
| 365 |
+
vis_dataset_selector = gr.Dropdown(choices=[], label="Dataset", visible=False)
|
| 366 |
+
vis_single_metric_selector = gr.Dropdown(choices=[], label="Metric", visible=False)
|
| 367 |
+
|
| 368 |
+
# ββ method selectors (two accordions) βββββββββββββββββββββββ
|
| 369 |
base_method_names = [m for m in method_names if m in base_methods]
|
| 370 |
user_method_names = [m for m in method_names if m not in base_methods]
|
| 371 |
|
|
|
|
| 385 |
interactive=True,
|
| 386 |
)
|
| 387 |
|
| 388 |
+
# ββ plot button & output ββββββββββββββββββββββββββββββββββββ
|
| 389 |
plot_button = gr.Button("Plot")
|
| 390 |
+
|
| 391 |
with gr.Row(show_progress=True, variant='panel'):
|
| 392 |
plot_output = gr.Image(label="Plot")
|
| 393 |
+
|
| 394 |
gr.Markdown("#### If a method name ends with **^**, it suggests potential suspicions of data leakage related to ***similarity***, ***function***, or ***family*** benchmarks.")
|
| 395 |
+
|
| 396 |
+
# ββ callbacks βββββββββββββββββββββββββββββββββββββββββββββββ
|
|
|
|
| 397 |
vis_benchmark_type_selector.change(
|
| 398 |
update_metric_choices,
|
| 399 |
inputs=[vis_benchmark_type_selector],
|
|
|
|
| 405 |
vis_single_metric_selector,
|
| 406 |
],
|
| 407 |
)
|
| 408 |
+
|
| 409 |
+
# combine the two method lists, then call the original helper
|
| 410 |
plot_button.click(
|
| 411 |
+
lambda bt, base_sel, user_sel, xm, ym, asp, ds, sm: generate_plot(
|
| 412 |
+
bt,
|
| 413 |
+
(base_sel or []) + (user_sel or []), # merged method list
|
| 414 |
+
xm, ym, asp, ds, sm,
|
| 415 |
+
),
|
| 416 |
inputs=[
|
| 417 |
vis_benchmark_type_selector,
|
| 418 |
+
vis_method_selector_base,
|
| 419 |
+
vis_method_selector_user,
|
| 420 |
vis_x_metric_selector,
|
| 421 |
vis_y_metric_selector,
|
| 422 |
vis_aspect_type_selector,
|