fix(leaderboard): restore per-language drilldown on row click#6
Merged
Conversation
Read the clicked row's model_id from `gr.SelectData.row_value` directly instead of resolving it via the Dataframe component as an event input. Gradio 6's `Dataframe.preprocess` converts the value to a `pandas.DataFrame` before handing it to the callback, so the `isinstance(table_value, dict)` branch I added in #5 never fired and every row click silently returned the "click a row" placeholder. `row_value` carries the full clicked row (Gradio docs: "the value of the entire row that the selected item belongs to, as a 1-D list"), so the post-toggle ordering is still respected without us having to thread the Dataframe through the input list. Add a regression test that hands `_on_select` a mock SelectData with an `index` + `row_value` and asserts the drilldown payload comes back populated.
Point the HF Space at git+https://github.com/commoncrawl/commonlid-eval@main so deployment picks up runtime fixes without waiting on a PyPI release. Pinning to a tag or commit SHA stays a single requirements-file edit away.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two changes that together get the deployed Space back into working order and keep it in sync with
maingoing forward.1. Restore the per-language drilldown on row click (
src/commonlid/leaderboard/app.py)Row clicks on the leaderboard table stopped opening the per-language drilldown after #5 merged and
commonlid-resultswas bumped to schema v3.Cause: #5 wired
inputs=[leaderboard]into the row-select handler and readmodel_idout of the assumed{"data", "headers"}dict. Gradio 6'sDataframe.preprocessconverts component values topandas.DataFramebefore handing them to callbacks (defaulttype="pandas"), soisinstance(table_value, dict)was alwaysFalseand the handler silently returned the "Click a row to load per-language metrics." placeholder.Fix: read the clicked row from
gr.SelectData.row_value(Gradio docs: "the value of the entire row that the selected item belongs to, as a 1-D list").model_id = evt.row_value[0]works for both the "all" and "(cov.)" scopes becauserow_valuealways reflects the row at its post-toggle position.inputs=[leaderboard]is dropped.2. Install commonlid from GitHub main in the HF Space (
hf-space/requirements.txt)The Space was pulling
commonlid[leaderboard]from PyPI, which forced a release for every Space-affecting change. Switch tocommonlid[leaderboard] @ git+https://github.com/commoncrawl/commonlid-eval.git@mainso the next Space rebuild picks upmaindirectly. Pinning to a tag or SHA stays a single edit away.Test plan
make lint && make typecheck— clean.make test— 249 passed, 95.83% coverage. New tests:test_row_select_handler_loads_drilldown_from_row_value(regression on the click → drilldown payload pipe) andtest_row_select_handler_returns_placeholder_when_index_missing.commonlid leaderboard serve --repo-id commoncrawl/commonlid-resultsloads the live HF dataset and the app comes up clean.main(drilldown clicks now work end-to-end against the live dataset).