Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Commit ·
e8ccae5
1
Parent(s): 377037a
Moderate tab: private diarization leaderboard preview
Browse filesModerators see the diarization board (with a Reload from bucket button)
after unlocking, while the public Diarization track stays switched off.
All of its text and rows are sent only after an unlock.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -3353,6 +3353,54 @@ with gr.Blocks(title=APP_TITLE, theme=_theme, css=LEADERBOARD_CSS, head=ANALYSIS
|
|
| 3353 |
lineage_save_btn = gr.Button("Save base model", variant="secondary")
|
| 3354 |
lineage_fill_btn = gr.Button("Read missing base models from the Hub", variant="secondary")
|
| 3355 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3356 |
def _mod_unlock(secret: str, request: gr.Request = None):
|
| 3357 |
ok, msg = _verify_secret(secret, request)
|
| 3358 |
if not ok:
|
|
@@ -3371,6 +3419,28 @@ with gr.Blocks(title=APP_TITLE, theme=_theme, css=LEADERBOARD_CSS, head=ANALYSIS
|
|
| 3371 |
gr.Timer(active=True),
|
| 3372 |
)
|
| 3373 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3374 |
def _mod_progress_gated(unlocked: bool):
|
| 3375 |
if not unlocked:
|
| 3376 |
return job_queue.moderation_locked_placeholder_html()
|
|
@@ -3424,18 +3494,36 @@ with gr.Blocks(title=APP_TITLE, theme=_theme, css=LEADERBOARD_CSS, head=ANALYSIS
|
|
| 3424 |
)
|
| 3425 |
|
| 3426 |
# Moderator events (all hidden from the public API).
|
| 3427 |
-
mod_unlock_btn.click(
|
| 3428 |
fn=_mod_unlock,
|
| 3429 |
inputs=[mod_secret],
|
| 3430 |
outputs=[mod_unlocked, mod_panel, mod_unlock_feedback, mod_refresh_tick, _progress_timer],
|
| 3431 |
api_name=False,
|
| 3432 |
)
|
| 3433 |
-
mod_secret.submit(
|
| 3434 |
fn=_mod_unlock,
|
| 3435 |
inputs=[mod_secret],
|
| 3436 |
outputs=[mod_unlocked, mod_panel, mod_unlock_feedback, mod_refresh_tick, _progress_timer],
|
| 3437 |
api_name=False,
|
| 3438 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3439 |
mod_refresh.click(
|
| 3440 |
fn=_mod_refresh_lists,
|
| 3441 |
inputs=[mod_secret, mod_unlocked, mod_refresh_tick],
|
|
|
|
| 3353 |
lineage_save_btn = gr.Button("Save base model", variant="secondary")
|
| 3354 |
lineage_fill_btn = gr.Button("Read missing base models from the Hub", variant="secondary")
|
| 3355 |
|
| 3356 |
+
# Private preview of the diarization board, built whatever FFASR_ENABLE_DIARIZATION
|
| 3357 |
+
# says. Its text and rows reach the browser only after an unlock: component props
|
| 3358 |
+
# ship to every visitor, so nothing here names the track (tests/test_features.py).
|
| 3359 |
+
mod_diar_intro = gr.Markdown("")
|
| 3360 |
+
with gr.Row(equal_height=True, elem_classes="ff-toolbar"):
|
| 3361 |
+
mod_diar_search = gr.Textbox(
|
| 3362 |
+
label="Search models",
|
| 3363 |
+
show_label=False,
|
| 3364 |
+
container=False,
|
| 3365 |
+
placeholder="Search models",
|
| 3366 |
+
lines=1,
|
| 3367 |
+
max_lines=1,
|
| 3368 |
+
scale=3,
|
| 3369 |
+
)
|
| 3370 |
+
mod_diar_view = gr.Radio(
|
| 3371 |
+
choices=list(OVERLAP_VIEWS),
|
| 3372 |
+
value=OVERLAP_VIEW_ALL,
|
| 3373 |
+
label="Overlap",
|
| 3374 |
+
show_label=False,
|
| 3375 |
+
container=False,
|
| 3376 |
+
elem_classes=["ff-seg"],
|
| 3377 |
+
scale=0,
|
| 3378 |
+
)
|
| 3379 |
+
mod_diar_metric = gr.Radio(
|
| 3380 |
+
choices=_DIAR_METRIC_CHOICES,
|
| 3381 |
+
value="der",
|
| 3382 |
+
label="Rank by",
|
| 3383 |
+
show_label=False,
|
| 3384 |
+
container=False,
|
| 3385 |
+
elem_classes=["ff-seg"],
|
| 3386 |
+
scale=0,
|
| 3387 |
+
)
|
| 3388 |
+
mod_diar_reload = gr.Button("Reload from bucket", variant="secondary", scale=0, min_width=160)
|
| 3389 |
+
mod_diar_columns = gr.CheckboxGroup(
|
| 3390 |
+
choices=list(dr.TOGGLEABLE_COLS),
|
| 3391 |
+
value=list(dr.DEFAULT_VISIBLE_COLS),
|
| 3392 |
+
label="Columns to show",
|
| 3393 |
+
)
|
| 3394 |
+
mod_diar_table = gr.HTML(
|
| 3395 |
+
"",
|
| 3396 |
+
padding=False,
|
| 3397 |
+
elem_id="mod-preview-table",
|
| 3398 |
+
elem_classes=["ff-board"],
|
| 3399 |
+
)
|
| 3400 |
+
mod_diar_caption = gr.Markdown("", elem_classes="ffasr-view-caption")
|
| 3401 |
+
with gr.Accordion("How to read this table", open=False):
|
| 3402 |
+
mod_diar_guide = gr.Markdown("", elem_classes="markdown-text")
|
| 3403 |
+
|
| 3404 |
def _mod_unlock(secret: str, request: gr.Request = None):
|
| 3405 |
ok, msg = _verify_secret(secret, request)
|
| 3406 |
if not ok:
|
|
|
|
| 3419 |
gr.Timer(active=True),
|
| 3420 |
)
|
| 3421 |
|
| 3422 |
+
def _mod_diar_board(unlocked: bool, search, view, metric, cols, reload: bool = False):
|
| 3423 |
+
if not unlocked:
|
| 3424 |
+
return "", ""
|
| 3425 |
+
if reload:
|
| 3426 |
+
dr.invalidate_cache()
|
| 3427 |
+
return _diar_table_update(search, view, metric, cols)
|
| 3428 |
+
|
| 3429 |
+
def _mod_diar_reload(unlocked: bool, search, view, metric, cols):
|
| 3430 |
+
return _mod_diar_board(unlocked, search, view, metric, cols, reload=True)
|
| 3431 |
+
|
| 3432 |
+
def _mod_diar_text(unlocked: bool):
|
| 3433 |
+
"""Heading and table guide of the private diarization board, for unlocked sessions."""
|
| 3434 |
+
if not unlocked:
|
| 3435 |
+
return "", ""
|
| 3436 |
+
intro = (
|
| 3437 |
+
"### Diarization leaderboard (private preview)\n\n"
|
| 3438 |
+
f"Only moderators see this board. It reads <code>{dr.DIARIZATION_RESULTS_PATH}</code> "
|
| 3439 |
+
"from the bucket. After you add or change rows there, click **Reload from bucket**."
|
| 3440 |
+
+ ("" if features.diarization_enabled() else " The public Diarization track stays off.")
|
| 3441 |
+
)
|
| 3442 |
+
return intro, dr.table_guide_md()
|
| 3443 |
+
|
| 3444 |
def _mod_progress_gated(unlocked: bool):
|
| 3445 |
if not unlocked:
|
| 3446 |
return job_queue.moderation_locked_placeholder_html()
|
|
|
|
| 3494 |
)
|
| 3495 |
|
| 3496 |
# Moderator events (all hidden from the public API).
|
| 3497 |
+
_mod_unlock_click = mod_unlock_btn.click(
|
| 3498 |
fn=_mod_unlock,
|
| 3499 |
inputs=[mod_secret],
|
| 3500 |
outputs=[mod_unlocked, mod_panel, mod_unlock_feedback, mod_refresh_tick, _progress_timer],
|
| 3501 |
api_name=False,
|
| 3502 |
)
|
| 3503 |
+
_mod_unlock_secret = mod_secret.submit(
|
| 3504 |
fn=_mod_unlock,
|
| 3505 |
inputs=[mod_secret],
|
| 3506 |
outputs=[mod_unlocked, mod_panel, mod_unlock_feedback, mod_refresh_tick, _progress_timer],
|
| 3507 |
api_name=False,
|
| 3508 |
)
|
| 3509 |
+
_mod_diar_inputs = [mod_unlocked, mod_diar_search, mod_diar_view, mod_diar_metric, mod_diar_columns]
|
| 3510 |
+
_mod_diar_outputs = [mod_diar_table, mod_diar_caption]
|
| 3511 |
+
for _ev in (_mod_unlock_click, _mod_unlock_secret):
|
| 3512 |
+
_ev.then(
|
| 3513 |
+
fn=_mod_diar_text, inputs=[mod_unlocked], outputs=[mod_diar_intro, mod_diar_guide],
|
| 3514 |
+
show_progress="hidden", api_name=False,
|
| 3515 |
+
).then(
|
| 3516 |
+
fn=_mod_diar_reload, inputs=_mod_diar_inputs, outputs=_mod_diar_outputs,
|
| 3517 |
+
show_progress="hidden", api_name=False,
|
| 3518 |
+
)
|
| 3519 |
+
for _comp in _mod_diar_inputs[1:]:
|
| 3520 |
+
_comp.change(
|
| 3521 |
+
fn=_mod_diar_board, inputs=_mod_diar_inputs, outputs=_mod_diar_outputs,
|
| 3522 |
+
show_progress="hidden", api_name=False,
|
| 3523 |
+
)
|
| 3524 |
+
mod_diar_reload.click(
|
| 3525 |
+
fn=_mod_diar_reload, inputs=_mod_diar_inputs, outputs=_mod_diar_outputs, api_name=False,
|
| 3526 |
+
)
|
| 3527 |
mod_refresh.click(
|
| 3528 |
fn=_mod_refresh_lists,
|
| 3529 |
inputs=[mod_secret, mod_unlocked, mod_refresh_tick],
|