eduagarcia commited on
Commit
af40751
1 Parent(s): 8256554

Show plots on click

Browse files
Files changed (1) hide show
  1. app.py +18 -5
app.py CHANGED
@@ -318,40 +318,53 @@ def create_leaderboard_from_results(elo_results, model_table_df, show_plot, show
318
  """,
319
  elem_id="leaderboard_markdown"
320
  )
 
 
321
  fig_id = 1
322
  if show_language_plot:
323
  gr.Markdown(
324
  f"#### Figure {fig_id}: Battle counts for the Top 15 Languages"
325
  )
326
- plot_0 = gr.Plot(p0, show_label=False)
327
  fig_id += 1
328
  with gr.Row():
329
  with gr.Column():
330
  gr.Markdown(
331
  f"#### Figure {fig_id}: Fraction of Model A Wins for All Non-tied A vs. B Battles"
332
  )
333
- plot_1 = gr.Plot(p1, show_label=False)
334
  fig_id += 1
335
  with gr.Column():
336
  gr.Markdown(
337
  f"#### Figure {fig_id}: Battle Count for Each Combination of Models (without Ties)"
338
  )
339
- plot_2 = gr.Plot(p2, show_label=False)
340
  fig_id += 1
341
  with gr.Row():
342
  with gr.Column():
343
  gr.Markdown(
344
  f"#### Figure {fig_id}: Confidence Intervals on Model Strength (via Bootstrapping)"
345
  )
346
- plot_3 = gr.Plot(p3, show_label=False)
347
  fig_id += 1
348
  with gr.Column():
349
  gr.Markdown(
350
  f"#### Figure {fig_id}: Average Win Rate Against All Other Models (Assuming Uniform Sampling and No Ties)"
351
  )
352
- plot_4 = gr.Plot(p4, show_label=False)
353
  fig_id += 1
354
 
 
 
 
 
 
 
 
 
 
 
 
355
  return p1, p2, p3, p4, plot_1, plot_2, plot_3, plot_4
356
 
357
  def build_leaderboard_tab(elo_results_file, leaderboard_table_file, show_plot=False):
 
318
  """,
319
  elem_id="leaderboard_markdown"
320
  )
321
+
322
+ show_plot_btn = gr.Button("Show plots")
323
  fig_id = 1
324
  if show_language_plot:
325
  gr.Markdown(
326
  f"#### Figure {fig_id}: Battle counts for the Top 15 Languages"
327
  )
328
+ plot_0 = gr.Plot()
329
  fig_id += 1
330
  with gr.Row():
331
  with gr.Column():
332
  gr.Markdown(
333
  f"#### Figure {fig_id}: Fraction of Model A Wins for All Non-tied A vs. B Battles"
334
  )
335
+ plot_1 = gr.Plot()
336
  fig_id += 1
337
  with gr.Column():
338
  gr.Markdown(
339
  f"#### Figure {fig_id}: Battle Count for Each Combination of Models (without Ties)"
340
  )
341
+ plot_2 = gr.Plot()
342
  fig_id += 1
343
  with gr.Row():
344
  with gr.Column():
345
  gr.Markdown(
346
  f"#### Figure {fig_id}: Confidence Intervals on Model Strength (via Bootstrapping)"
347
  )
348
+ plot_3 = gr.Plot()
349
  fig_id += 1
350
  with gr.Column():
351
  gr.Markdown(
352
  f"#### Figure {fig_id}: Average Win Rate Against All Other Models (Assuming Uniform Sampling and No Ties)"
353
  )
354
+ plot_4 = gr.Plot()
355
  fig_id += 1
356
 
357
+ def get_plots(*args):
358
+ if show_language_plot:
359
+ return p0, p1, p2, p3, p4
360
+ else:
361
+ return p1, p2, p3, p4
362
+
363
+ if show_language_plot:
364
+ show_plot_btn.click(fn=get_plots, outputs=[plot_0, plot_1, plot_2, plot_3, plot_4])
365
+ else:
366
+ show_plot_btn.click(fn=get_plots, outputs=[plot_1, plot_2, plot_3, plot_4])
367
+
368
  return p1, p2, p3, p4, plot_1, plot_2, plot_3, plot_4
369
 
370
  def build_leaderboard_tab(elo_results_file, leaderboard_table_file, show_plot=False):