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>
3352 unmodified lines33533354335533563357335812 unmodified lines33713372337333743375337647 unmodified lines3424342534263427342834293430343134323433343434353436343734383439344034413352 unmodified lineslineage_save_btn = gr.Button("Save base model", variant="secondary")lineage_fill_btn = gr.Button("Read missing base models from the Hub", variant="secondary")def _mod_unlock(secret: str, request: gr.Request = None):ok, msg = _verify_secret(secret, request)if not ok:12 unmodified linesgr.Timer(active=True),)def _mod_progress_gated(unlocked: bool):if not unlocked:return job_queue.moderation_locked_placeholder_html()47 unmodified lines)# Moderator events (all hidden from the public API).mod_unlock_btn.click(fn=_mod_unlock,inputs=[mod_secret],outputs=[mod_unlocked, mod_panel, mod_unlock_feedback, mod_refresh_tick, _progress_timer],api_name=False,)mod_secret.submit(fn=_mod_unlock,inputs=[mod_secret],outputs=[mod_unlocked, mod_panel, mod_unlock_feedback, mod_refresh_tick, _progress_timer],api_name=False,)mod_refresh.click(fn=_mod_refresh_lists,inputs=[mod_secret, mod_unlocked, mod_refresh_tick],3352 unmodified lines33533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340612 unmodified lines341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344647 unmodified lines3494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293352 unmodified lineslineage_save_btn = gr.Button("Save base model", variant="secondary")lineage_fill_btn = gr.Button("Read missing base models from the Hub", variant="secondary")# Private preview of the diarization board, built whatever FFASR_ENABLE_DIARIZATION# says. Its text and rows reach the browser only after an unlock: component props# ship to every visitor, so nothing here names the track (tests/test_features.py).mod_diar_intro = gr.Markdown("")with gr.Row(equal_height=True, elem_classes="ff-toolbar"):mod_diar_search = gr.Textbox(label="Search models",show_label=False,container=False,placeholder="Search models",lines=1,max_lines=1,scale=3,)mod_diar_view = gr.Radio(choices=list(OVERLAP_VIEWS),value=OVERLAP_VIEW_ALL,label="Overlap",show_label=False,container=False,elem_classes=["ff-seg"],scale=0,)mod_diar_metric = gr.Radio(choices=_DIAR_METRIC_CHOICES,value="der",label="Rank by",show_label=False,container=False,elem_classes=["ff-seg"],scale=0,)mod_diar_reload = gr.Button("Reload from bucket", variant="secondary", scale=0, min_width=160)mod_diar_columns = gr.CheckboxGroup(choices=list(dr.TOGGLEABLE_COLS),value=list(dr.DEFAULT_VISIBLE_COLS),label="Columns to show",)mod_diar_table = gr.HTML("",padding=False,elem_id="mod-preview-table",elem_classes=["ff-board"],)mod_diar_caption = gr.Markdown("", elem_classes="ffasr-view-caption")with gr.Accordion("How to read this table", open=False):mod_diar_guide = gr.Markdown("", elem_classes="markdown-text")def _mod_unlock(secret: str, request: gr.Request = None):ok, msg = _verify_secret(secret, request)if not ok:12 unmodified linesgr.Timer(active=True),)def _mod_diar_board(unlocked: bool, search, view, metric, cols, reload: bool = False):if not unlocked:return "", ""if reload:dr.invalidate_cache()return _diar_table_update(search, view, metric, cols)def _mod_diar_reload(unlocked: bool, search, view, metric, cols):return _mod_diar_board(unlocked, search, view, metric, cols, reload=True)def _mod_diar_text(unlocked: bool):"""Heading and table guide of the private diarization board, for unlocked sessions."""if not unlocked:return "", ""intro = ("### Diarization leaderboard (private preview)\n\n"f"Only moderators see this board. It reads <code>{dr.DIARIZATION_RESULTS_PATH}</code> ""from the bucket. After you add or change rows there, click **Reload from bucket**."+ ("" if features.diarization_enabled() else " The public Diarization track stays off."))return intro, dr.table_guide_md()def _mod_progress_gated(unlocked: bool):if not unlocked:return job_queue.moderation_locked_placeholder_html()47 unmodified lines)# Moderator events (all hidden from the public API)._mod_unlock_click = mod_unlock_btn.click(fn=_mod_unlock,inputs=[mod_secret],outputs=[mod_unlocked, mod_panel, mod_unlock_feedback, mod_refresh_tick, _progress_timer],api_name=False,)_mod_unlock_secret = mod_secret.submit(fn=_mod_unlock,inputs=[mod_secret],outputs=[mod_unlocked, mod_panel, mod_unlock_feedback, mod_refresh_tick, _progress_timer],api_name=False,)_mod_diar_inputs = [mod_unlocked, mod_diar_search, mod_diar_view, mod_diar_metric, mod_diar_columns]_mod_diar_outputs = [mod_diar_table, mod_diar_caption]for _ev in (_mod_unlock_click, _mod_unlock_secret):_ev.then(fn=_mod_diar_text, inputs=[mod_unlocked], outputs=[mod_diar_intro, mod_diar_guide],show_progress="hidden", api_name=False,).then(fn=_mod_diar_reload, inputs=_mod_diar_inputs, outputs=_mod_diar_outputs,show_progress="hidden", api_name=False,)for _comp in _mod_diar_inputs[1:]:_comp.change(fn=_mod_diar_board, inputs=_mod_diar_inputs, outputs=_mod_diar_outputs,show_progress="hidden", api_name=False,)mod_diar_reload.click(fn=_mod_diar_reload, inputs=_mod_diar_inputs, outputs=_mod_diar_outputs, api_name=False,)mod_refresh.click(fn=_mod_refresh_lists,inputs=[mod_secret, mod_unlocked, mod_refresh_tick],
app.py+90-2