Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
Β·
fbd0e7d
1
Parent(s):
492c93e
Refactor search_leaderboard to use retrieval_df and update UI tab labels for clarity
Browse files
app.py
CHANGED
@@ -40,15 +40,15 @@ CITATION_BUTTON_TEXT = """
|
|
40 |
}
|
41 |
"""
|
42 |
|
43 |
-
|
44 |
original_columns_order = None
|
45 |
|
46 |
def search_leaderboard(model_name, columns_to_show):
|
47 |
if len(model_name.strip()) == 0:
|
48 |
-
return
|
49 |
|
50 |
threshold = 95 # You can adjust this value to make the search more or less strict
|
51 |
-
filtered_df =
|
52 |
|
53 |
def calculate_similarity(row):
|
54 |
similarity = fuzz.partial_ratio(model_name.lower(), row["Model"].lower())
|
@@ -70,20 +70,20 @@ def search_leaderboard(model_name, columns_to_show):
|
|
70 |
|
71 |
|
72 |
def main():
|
73 |
-
global
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
|
79 |
columns_to_show = ["Model", "Web Search Dataset (Overall Score)", "Model Size (in Millions)", "Embedding Dimension", "Max Tokens", "Num Likes"]
|
80 |
with gr.Blocks() as demo:
|
81 |
gr.HTML(HEADER)
|
82 |
|
83 |
with gr.Tabs():
|
84 |
-
with gr.Tab("Retrieval"):
|
85 |
with gr.Tabs():
|
86 |
-
with gr.Tab("Leaderboard"):
|
87 |
with gr.Row():
|
88 |
search_box_retrieval = gr.Textbox(
|
89 |
placeholder="Search for models...",
|
@@ -92,13 +92,13 @@ def main():
|
|
92 |
)
|
93 |
columns_to_show_input = gr.CheckboxGroup(
|
94 |
label="Columns to Show",
|
95 |
-
choices=
|
96 |
value=columns_to_show,
|
97 |
scale=4
|
98 |
)
|
99 |
|
100 |
retrieval_leaderboard = gr.Dataframe(
|
101 |
-
value=
|
102 |
datatype="markdown",
|
103 |
wrap=True,
|
104 |
show_fullscreen_button=True,
|
@@ -112,17 +112,20 @@ def main():
|
|
112 |
outputs=retrieval_leaderboard
|
113 |
)
|
114 |
columns_to_show_input.select(
|
115 |
-
lambda columns:
|
116 |
inputs=columns_to_show_input,
|
117 |
outputs=retrieval_leaderboard
|
118 |
)
|
119 |
|
120 |
-
with gr.Tab("Submit Retriever"):
|
121 |
submit_gradio_module("Retriever")
|
122 |
|
123 |
-
|
|
|
|
|
|
|
124 |
with gr.Tabs():
|
125 |
-
with gr.Tab("Leaderboard"):
|
126 |
search_box_reranker = gr.Textbox(
|
127 |
placeholder="Search for models...",
|
128 |
label="Search",
|
@@ -130,7 +133,7 @@ def main():
|
|
130 |
)
|
131 |
|
132 |
reranker_leaderboard = gr.Dataframe(
|
133 |
-
value=
|
134 |
datatype="markdown",
|
135 |
wrap=True,
|
136 |
show_fullscreen_button=True,
|
@@ -143,11 +146,13 @@ def main():
|
|
143 |
outputs=reranker_leaderboard
|
144 |
)
|
145 |
|
146 |
-
with gr.Tab("Submit Reranker"):
|
147 |
submit_gradio_module("Reranker")
|
148 |
|
|
|
|
|
149 |
|
150 |
-
# with gr.Tab("LLM Context Answering"):
|
151 |
# with gr.Tabs():
|
152 |
# with gr.Tab("Leaderboard"):
|
153 |
# pass
|
|
|
40 |
}
|
41 |
"""
|
42 |
|
43 |
+
retrieval_df = None
|
44 |
original_columns_order = None
|
45 |
|
46 |
def search_leaderboard(model_name, columns_to_show):
|
47 |
if len(model_name.strip()) == 0:
|
48 |
+
return retrieval_df.loc[:, columns_to_show]
|
49 |
|
50 |
threshold = 95 # You can adjust this value to make the search more or less strict
|
51 |
+
filtered_df = retrieval_df.copy()
|
52 |
|
53 |
def calculate_similarity(row):
|
54 |
similarity = fuzz.partial_ratio(model_name.lower(), row["Model"].lower())
|
|
|
70 |
|
71 |
|
72 |
def main():
|
73 |
+
global retrieval_df, original_columns_order
|
74 |
+
retrieval_df = load_retrieval_results()
|
75 |
+
retrieval_df[["Model"]] = retrieval_df[["Model"]].map(lambda x: f'<a href="https://huggingface.co/{x}" target="_blank">{x}</a>')
|
76 |
+
retrieval_df.drop(columns=["Revision", "Precision", "Task"], inplace=True)
|
77 |
+
retrieval_df.sort_values("Web Search Dataset (Overall Score)", ascending=False, inplace=True)
|
78 |
|
79 |
columns_to_show = ["Model", "Web Search Dataset (Overall Score)", "Model Size (in Millions)", "Embedding Dimension", "Max Tokens", "Num Likes"]
|
80 |
with gr.Blocks() as demo:
|
81 |
gr.HTML(HEADER)
|
82 |
|
83 |
with gr.Tabs():
|
84 |
+
with gr.Tab("π΅οΈββοΈ Retrieval"):
|
85 |
with gr.Tabs():
|
86 |
+
with gr.Tab("π Leaderboard"):
|
87 |
with gr.Row():
|
88 |
search_box_retrieval = gr.Textbox(
|
89 |
placeholder="Search for models...",
|
|
|
92 |
)
|
93 |
columns_to_show_input = gr.CheckboxGroup(
|
94 |
label="Columns to Show",
|
95 |
+
choices=retrieval_df.columns.tolist(),
|
96 |
value=columns_to_show,
|
97 |
scale=4
|
98 |
)
|
99 |
|
100 |
retrieval_leaderboard = gr.Dataframe(
|
101 |
+
value=retrieval_df[columns_to_show],
|
102 |
datatype="markdown",
|
103 |
wrap=True,
|
104 |
show_fullscreen_button=True,
|
|
|
112 |
outputs=retrieval_leaderboard
|
113 |
)
|
114 |
columns_to_show_input.select(
|
115 |
+
lambda columns: retrieval_df.loc[:, columns],
|
116 |
inputs=columns_to_show_input,
|
117 |
outputs=retrieval_leaderboard
|
118 |
)
|
119 |
|
120 |
+
with gr.Tab("π΅οΈ Submit Retriever"):
|
121 |
submit_gradio_module("Retriever")
|
122 |
|
123 |
+
with gr.Tab("βΉοΈ About"):
|
124 |
+
gr.Markdown(ABOUT_SECTION)
|
125 |
+
|
126 |
+
with gr.Tab("π Reranking"):
|
127 |
with gr.Tabs():
|
128 |
+
with gr.Tab("π Leaderboard"):
|
129 |
search_box_reranker = gr.Textbox(
|
130 |
placeholder="Search for models...",
|
131 |
label="Search",
|
|
|
133 |
)
|
134 |
|
135 |
reranker_leaderboard = gr.Dataframe(
|
136 |
+
value=retrieval_df[columns_to_show],
|
137 |
datatype="markdown",
|
138 |
wrap=True,
|
139 |
show_fullscreen_button=True,
|
|
|
146 |
outputs=reranker_leaderboard
|
147 |
)
|
148 |
|
149 |
+
with gr.Tab("π΅οΈ Submit Reranker"):
|
150 |
submit_gradio_module("Reranker")
|
151 |
|
152 |
+
with gr.Tab("βΉοΈ About"):
|
153 |
+
gr.Markdown(ABOUT_SECTION)
|
154 |
|
155 |
+
# with gr.Tab("π§ LLM Context Answering"):
|
156 |
# with gr.Tabs():
|
157 |
# with gr.Tab("Leaderboard"):
|
158 |
# pass
|