MohamedRashad commited on
Commit
a40f7ce
Β·
1 Parent(s): bc40b2e

Enhance leaderboard display by adding a description and adjusting column widths for retrieval and reranking dataframes

Browse files
Files changed (1) hide show
  1. app.py +32 -11
app.py CHANGED
@@ -4,8 +4,13 @@ from fuzzywuzzy import fuzz
4
 
5
  HEADER = """<div style="text-align: center; margin-bottom: 20px;">
6
  <h1>The Arabic RAG Leaderboard</h1>
7
- <p style="font-size: 14px; color: #888;">The only leaderboard you will require for your RAG needs πŸ†</p>
8
  </div>
 
 
 
 
 
9
  """
10
 
11
  RETRIEVAL_ABOUT_SECTION = """
@@ -107,14 +112,28 @@ def reranking_search_leaderboard(model_name, columns_to_show):
107
 
108
  def update_retrieval_columns_to_show(columns_to_show):
109
  global retrieval_df
110
- dummy_df = retrieval_df.loc[:, columns_to_show]
111
- columns_widths = [400] + [150] * (len(columns_to_show) - 1)
 
 
 
 
 
 
 
112
  return gr.update(value=dummy_df, column_widths=columns_widths)
113
 
114
  def update_reranker_columns_to_show(columns_to_show):
115
  global reranking_df
116
- dummy_df = reranking_df.loc[:, columns_to_show]
117
- columns_widths = [400] + [150] * (len(columns_to_show) - 1)
 
 
 
 
 
 
 
118
  return gr.update(value=dummy_df, column_widths=columns_widths)
119
 
120
  def main():
@@ -122,14 +141,16 @@ def main():
122
 
123
  # Prepare retrieval dataframe
124
  retrieval_df = load_retrieval_results(True, "Web Search Dataset (Overall Score)", ["Revision", "Precision", "Task"])
125
- retrieval_columns_to_show = ["Model", "Web Search Dataset (Overall Score)", "Model Size (MB)", "Embedding Dimension", "Max Tokens", "Num Likes"]
126
-
 
127
  retrieval_cols = retrieval_df.columns.tolist() # cache columns
128
 
129
  # Prepare reranking dataframe
130
  reranking_df = load_reranking_results(True, sort_col="Overall Score", drop_cols=["Revision", "Precision", "Task"])
131
- reranking_columns_to_show = ["Model", "Overall Score", "Model Parameters (in Millions)", "Embedding Dimensions", "Downloads Last Month", "MRR", "nDCG", "MAP"]
132
- reranking_columns_widths = [400, 150, 150, 150, 150, 150, 150]
 
133
  reranking_cols = reranking_df.columns.tolist() # cache columns
134
 
135
  with gr.Blocks() as demo:
@@ -153,12 +174,12 @@ def main():
153
  )
154
 
155
  retrieval_leaderboard = gr.Dataframe(
156
- value=retrieval_df[retrieval_columns_to_show],
157
  datatype="markdown",
158
  wrap=False,
159
  show_fullscreen_button=True,
160
  interactive=False,
161
- column_widths=reranking_columns_widths
162
  )
163
 
164
  # Submit the search box and the leaderboard
 
4
 
5
  HEADER = """<div style="text-align: center; margin-bottom: 20px;">
6
  <h1>The Arabic RAG Leaderboard</h1>
7
+ <p style="font-size: 16px; color: #888;">The only leaderboard you will require for your RAG needs πŸ†</p>
8
  </div>
9
+
10
+ This leaderboard presents the first comprehensive benchmark for Arabic RAG systems, evaluating both retrieval and re-ranking components. Our framework combines real-world queries with synthetic contexts in a dynamic evaluation cycle, ensuring fair and robust assessment of Arabic information retrieval systems.
11
+ <br>
12
+ <br>
13
+ For technical details, check our blog post <a href="https://huggingface.co/blog/Navid-AI/arabic-rag-leaderboard">here</a>.
14
  """
15
 
16
  RETRIEVAL_ABOUT_SECTION = """
 
112
 
113
  def update_retrieval_columns_to_show(columns_to_show):
114
  global retrieval_df
115
+ dummy_df = retrieval_df.loc[:, [col for col in retrieval_df.columns if col in columns_to_show]]
116
+ columns_widths = []
117
+ for col in dummy_df.columns:
118
+ if col == "Rank":
119
+ columns_widths.append(80)
120
+ elif col == "Model":
121
+ columns_widths.append(400)
122
+ else:
123
+ columns_widths.append(150)
124
  return gr.update(value=dummy_df, column_widths=columns_widths)
125
 
126
  def update_reranker_columns_to_show(columns_to_show):
127
  global reranking_df
128
+ dummy_df = reranking_df.loc[:, [col for col in reranking_df.columns if col in columns_to_show]]
129
+ columns_widths = []
130
+ for col in dummy_df.columns:
131
+ if col == "Rank":
132
+ columns_widths.append(80)
133
+ elif col == "Model":
134
+ columns_widths.append(400)
135
+ else:
136
+ columns_widths.append(150)
137
  return gr.update(value=dummy_df, column_widths=columns_widths)
138
 
139
  def main():
 
141
 
142
  # Prepare retrieval dataframe
143
  retrieval_df = load_retrieval_results(True, "Web Search Dataset (Overall Score)", ["Revision", "Precision", "Task"])
144
+ retrieval_columns_to_show = ["Rank", "Model", "Web Search Dataset (Overall Score)", "Model Size (MB)", "Embedding Dimension", "Max Tokens", "Num Likes"]
145
+ retrieval_columns_widths = [80, 400, 150, 150, 150, 150, 150]
146
+ retrieval_df.insert(0, "Rank", range(1, 1 + len(retrieval_df)))
147
  retrieval_cols = retrieval_df.columns.tolist() # cache columns
148
 
149
  # Prepare reranking dataframe
150
  reranking_df = load_reranking_results(True, sort_col="Overall Score", drop_cols=["Revision", "Precision", "Task"])
151
+ reranking_columns_to_show = ["Rank", "Model", "Overall Score", "Model Parameters (in Millions)", "Embedding Dimensions", "Downloads Last Month", "MRR", "nDCG", "MAP"]
152
+ reranking_columns_widths = [80, 400, 150, 150, 150, 150, 150, 150, 150]
153
+ reranking_df.insert(0, "Rank", range(1, 1 + len(reranking_df)))
154
  reranking_cols = reranking_df.columns.tolist() # cache columns
155
 
156
  with gr.Blocks() as demo:
 
174
  )
175
 
176
  retrieval_leaderboard = gr.Dataframe(
177
+ value=retrieval_df.loc[:, retrieval_columns_to_show],
178
  datatype="markdown",
179
  wrap=False,
180
  show_fullscreen_button=True,
181
  interactive=False,
182
+ column_widths=retrieval_columns_widths
183
  )
184
 
185
  # Submit the search box and the leaderboard