Michael Rabinovich commited on
Commit ·
4ee70ef
1
Parent(s): b2f3ce6
app: drive auto-refresh via gr.Timer().tick instead of every= on Dataframe
Browse filesgr.Dataframe(every=N) was firing load_leaderboard on the server every
10s (verified via runtime logs), but the component's client-side
re-render after the initial value silently dropped rows added between
ticks. Same shape as gradio-app/gradio#8160 ("when the data already
exists ... it cannot be updated and the page needs to be refreshed").
Switch to gr.Timer(10).tick(fn=load_leaderboard, outputs=df_view).
Identical code path to the manual Refresh button: each tick is an
event fired through the standard component-update channel, which
re-renders reliably. The Refresh button stays as the "I want it now"
override.
app.py
CHANGED
|
@@ -54,8 +54,13 @@ with gr.Blocks(title="CADGenBench Leaderboard") as app:
|
|
| 54 |
interactive=False,
|
| 55 |
wrap=True,
|
| 56 |
label="Results (sorted by aggregate CAD score)",
|
| 57 |
-
every=10,
|
| 58 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
refresh_btn = gr.Button("Refresh", size="sm")
|
| 60 |
refresh_btn.click(fn=load_leaderboard, outputs=df_view)
|
| 61 |
|
|
|
|
| 54 |
interactive=False,
|
| 55 |
wrap=True,
|
| 56 |
label="Results (sorted by aggregate CAD score)",
|
|
|
|
| 57 |
)
|
| 58 |
+
# gr.Dataframe's built-in `every=` doesn't reliably re-render
|
| 59 |
+
# when rows are added between ticks (gradio-app/gradio#8160).
|
| 60 |
+
# Drive periodic updates through an explicit gr.Timer event,
|
| 61 |
+
# same code path as the manual Refresh button.
|
| 62 |
+
auto_refresh_timer = gr.Timer(10)
|
| 63 |
+
auto_refresh_timer.tick(fn=load_leaderboard, outputs=df_view)
|
| 64 |
refresh_btn = gr.Button("Refresh", size="sm")
|
| 65 |
refresh_btn.click(fn=load_leaderboard, outputs=df_view)
|
| 66 |
|