Skip to content

Commit

Permalink
fix: Fixed leaderboard search bar (#1852)
Browse files Browse the repository at this point in the history
Fixed leaderboard search bar
  • Loading branch information
x-tabdeveloping authored Jan 22, 2025
1 parent afd3c77 commit fe33061
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mteb/leaderboard/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def filter_models(
with gr.Row():
searchbar = gr.Textbox(
label="Search Models",
info="Search models by name (RegEx sensitive. Separate queries with `|`)",
info="Press Enter to search.\nSearch models by name (RegEx sensitive. Separate queries with `|`)",
interactive=True,
)
compatibility = gr.CheckboxGroup(
Expand Down Expand Up @@ -626,7 +626,7 @@ def update_tables(
inputs=[scores, searchbar, task_select, models],
outputs=[summary_table, per_task_table],
)
searchbar.input(
searchbar.submit(
update_tables,
inputs=[scores, searchbar, task_select, models],
outputs=[summary_table, per_task_table],
Expand Down
5 changes: 5 additions & 0 deletions mteb/leaderboard/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ def scores_to_tables(
names = per_task.index.get_level_values("model_name")
names = pd.Series(names, index=per_task.index)
to_remove |= ~names.str.contains(search_query, regex=True)
if to_remove.all():
no_results_frame = pd.DataFrame(
{"No results": ["You can try relaxing your criteria"]}
)
return gr.DataFrame(no_results_frame), gr.DataFrame(no_results_frame)
models_to_remove = list(per_task[to_remove].index)
typed_mean = mean_per_type.mean(skipna=False, axis=1)
overall_mean = per_task.mean(skipna=False, axis=1)
Expand Down

0 comments on commit fe33061

Please sign in to comment.