Spaces:
Runtime error
Runtime error
refresh leaderboard
Browse files
app.py
CHANGED
@@ -209,8 +209,26 @@ chosen_one_second = functools.partial(chosen_one, 2)
|
|
209 |
chosen_one_tie = functools.partial(chosen_one, 0)
|
210 |
chosen_one_suck = functools.partial(chosen_one, 1)
|
211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
|
213 |
-
|
|
|
|
|
214 |
# Get column names (dataset features)
|
215 |
columns = list(dataset.features.keys())
|
216 |
# Start markdown string with table headers
|
@@ -226,10 +244,6 @@ def dataset_to_markdown(dataset):
|
|
226 |
return markdown_string
|
227 |
|
228 |
|
229 |
-
elo_scores = load_dataset("openaccess-ai-collective/chatbot-arena-elo-scores")
|
230 |
-
elo_scores = elo_scores["train"].sort("elo_score", reverse=True)
|
231 |
-
|
232 |
-
|
233 |
with gr.Blocks() as arena:
|
234 |
with gr.Row():
|
235 |
with gr.Column():
|
@@ -279,14 +293,14 @@ with gr.Blocks() as arena:
|
|
279 |
clear = gr.Button(value="New topic", variant="secondary").style(full_width=False)
|
280 |
with gr.Tab("Leaderboard"):
|
281 |
with gr.Column():
|
282 |
-
gr.Markdown(f"""
|
283 |
-
|
284 |
-
- This is very much a work-in-progress, if you'd like to help build this out, join us on [Discord](https://discord.gg/QYF8QrtEUm)
|
285 |
-
|
286 |
-
{dataset_to_markdown(elo_scores)}
|
287 |
""")
|
|
|
288 |
state = gr.State({})
|
289 |
|
|
|
|
|
290 |
clear.click(lambda: None, None, chatbot1, queue=False)
|
291 |
clear.click(lambda: None, None, chatbot2, queue=False)
|
292 |
clear.click(lambda: None, None, message, queue=False)
|
|
|
209 |
chosen_one_tie = functools.partial(chosen_one, 0)
|
210 |
chosen_one_suck = functools.partial(chosen_one, 1)
|
211 |
|
212 |
+
leaderboard_intro = """### TBD
|
213 |
+
- This is very much a work-in-progress, if you'd like to help build this out, join us on [Discord](https://discord.gg/QYF8QrtEUm)
|
214 |
+
|
215 |
+
"""
|
216 |
+
elo_scores = load_dataset("openaccess-ai-collective/chatbot-arena-elo-scores")
|
217 |
+
elo_scores = elo_scores["train"].sort("elo_score", reverse=True)
|
218 |
+
|
219 |
+
|
220 |
+
def refresh_md():
|
221 |
+
return leaderboard_intro + "\n" + dataset_to_markdown()
|
222 |
+
|
223 |
+
|
224 |
+
def fetch_elo_scores():
|
225 |
+
elo_scores = load_dataset("openaccess-ai-collective/chatbot-arena-elo-scores")
|
226 |
+
elo_scores = elo_scores["train"].sort("elo_score", reverse=True)
|
227 |
+
return elo_scores
|
228 |
|
229 |
+
|
230 |
+
def dataset_to_markdown():
|
231 |
+
dataset = fetch_elo_scores()
|
232 |
# Get column names (dataset features)
|
233 |
columns = list(dataset.features.keys())
|
234 |
# Start markdown string with table headers
|
|
|
244 |
return markdown_string
|
245 |
|
246 |
|
|
|
|
|
|
|
|
|
247 |
with gr.Blocks() as arena:
|
248 |
with gr.Row():
|
249 |
with gr.Column():
|
|
|
293 |
clear = gr.Button(value="New topic", variant="secondary").style(full_width=False)
|
294 |
with gr.Tab("Leaderboard"):
|
295 |
with gr.Column():
|
296 |
+
leaderboard_markdown = gr.Markdown(f"""{leaderboard_intro}
|
297 |
+
{dataset_to_markdown()}
|
|
|
|
|
|
|
298 |
""")
|
299 |
+
refresh = gr.Button(value="Refresh Leaderboard", variant="secondary").style(full_width=True)
|
300 |
state = gr.State({})
|
301 |
|
302 |
+
refresh.click(fn=refresh_md, inputs=[], outputs=refresh)
|
303 |
+
|
304 |
clear.click(lambda: None, None, chatbot1, queue=False)
|
305 |
clear.click(lambda: None, None, chatbot2, queue=False)
|
306 |
clear.click(lambda: None, None, message, queue=False)
|