From fe330611b6e433096501d0d9814b2c644c33e984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20Kardos?= Date: Wed, 22 Jan 2025 07:53:26 +0100 Subject: [PATCH] fix: Fixed leaderboard search bar (#1852) Fixed leaderboard search bar --- mteb/leaderboard/app.py | 4 ++-- mteb/leaderboard/table.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mteb/leaderboard/app.py b/mteb/leaderboard/app.py index f339c6142..5ee5a6b9d 100644 --- a/mteb/leaderboard/app.py +++ b/mteb/leaderboard/app.py @@ -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( @@ -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], diff --git a/mteb/leaderboard/table.py b/mteb/leaderboard/table.py index 2cb5fb34b..ef28392cf 100644 --- a/mteb/leaderboard/table.py +++ b/mteb/leaderboard/table.py @@ -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)