bhaskartripathi commited on
Commit
dfdb820
1 Parent(s): 18afa96

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -53,25 +53,25 @@ def update_leaderboard(leaderboard):
53
  try:
54
  df = scrape_leaderboard(leaderboard)
55
  chart = create_chart(df)
56
- return df, df.to_html(index=False), chart
57
  except Exception as e:
58
- return None, f"An error occurred: {str(e)}", None
59
 
60
  # Create Gradio interface
61
  with gr.Blocks() as iface:
62
  gr.Markdown("# Scale AI Leaderboard Viewer")
63
  dropdown = gr.Dropdown(choices=list(LEADERBOARDS.keys()), label="Select Leaderboard", value="Coding")
64
 
65
- table_output = gr.HTML()
66
  chart_output = gr.Plot()
 
67
 
68
  def on_load():
69
- df, html, chart = update_leaderboard("Coding")
70
- return html, chart
71
 
72
- dropdown.change(update_leaderboard, inputs=[dropdown], outputs=[table_output, table_output, chart_output])
73
 
74
- iface.load(on_load, outputs=[table_output, chart_output])
75
 
76
  # Launch the app
77
  iface.launch()
 
53
  try:
54
  df = scrape_leaderboard(leaderboard)
55
  chart = create_chart(df)
56
+ return chart, df.to_html(index=False)
57
  except Exception as e:
58
+ return None, f"An error occurred: {str(e)}"
59
 
60
  # Create Gradio interface
61
  with gr.Blocks() as iface:
62
  gr.Markdown("# Scale AI Leaderboard Viewer")
63
  dropdown = gr.Dropdown(choices=list(LEADERBOARDS.keys()), label="Select Leaderboard", value="Coding")
64
 
 
65
  chart_output = gr.Plot()
66
+ table_output = gr.HTML()
67
 
68
  def on_load():
69
+ chart, html = update_leaderboard("Coding")
70
+ return chart, html
71
 
72
+ dropdown.change(update_leaderboard, inputs=[dropdown], outputs=[chart_output, table_output])
73
 
74
+ iface.load(on_load, outputs=[chart_output, table_output])
75
 
76
  # Launch the app
77
  iface.launch()