Fix leaderboard auto-refresh with gr.Timer + demo.load (new results don't appear until Space restart)

#6
by davidkh - opened

New results never appear on the leaderboard until the Space restarts โ€” e.g. the 2026-07-05 geometrical submissions are in constellaration-bench-results but missing from the UI (reported in #5).

Cause: Leaderboard(value=get_leaderboard(), every=60) evaluates the function once at container startup and passes a static DataFrame, so every=60 has nothing to re-run โ€” the table is a snapshot of the last restart.

Fix: keep the concrete initial value (gradio_leaderboard requires one โ€” its __init__ reads value.columns, so a callable crashes) and refresh via events:

  • demo.load(get_leaderboard, outputs=leaderboard_table) โ€” fresh data on every page open
  • gr.Timer(60).tick(get_leaderboard, outputs=leaderboard_table) โ€” periodic refresh while the tab is open (replaces every=60)

Testing done

gradio 5.50.0 + gradio-leaderboard 0.0.14 (what the unpinned requirements resolve to today), harness reproducing this exact Leaderboard block against the live results dataset, get_leaderboard instrumented to log calls.

Case Result
main shape: static value + every=60 constructs; get_leaderboard runs once and never again โ€” bug reproduced
callable value=get_leaderboard (first commit, reverted) crashes at construction: AttributeError: 'function' object has no attribute 'columns' (leaderboard.py:128)
PR head: demo.load + Timer(60) renders; fresh fetch on every page open โ€” one refresh picked up a submission that landed in the dataset mid-test (110 โ†’ 111 rows)

Not directly observed: a periodic tick (test tab was never foreground-visible and Gradio pauses timers for hidden tabs; the tick shares its event wiring with the verified demo.load). Untouched/untested: Docker build, Submit and Visualize tabs.

davidkh changed pull request title from Fix leaderboard auto-refresh: pass get_leaderboard as callable to Fix leaderboard auto-refresh with gr.Timer + demo.load (new results don't appear until Space restart)
This comment has been hidden
alexbauer-pf changed pull request status to merged
Proxima Fusion org

Hi David,

Thank you very much for contributing to the challenge, for raising this issue and for opening the PR. We just merged it.

Best,
Alex

Hi Alex, happy to help. Thanks for the quick merge!

ConStellaration is a great thing: fields tend to take off once there's a public dataset and benchmark (e.g. ImageNet for vision). Glad to contribute a small piece.

Best,
David

Sign up or log in to comment