bhaskartripathi
commited on
Commit
•
dfdb820
1
Parent(s):
18afa96
Update app.py
Browse files
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
|
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 |
-
table_output = gr.HTML()
|
66 |
chart_output = gr.Plot()
|
|
|
67 |
|
68 |
def on_load():
|
69 |
-
|
70 |
-
return
|
71 |
|
72 |
-
dropdown.change(update_leaderboard, inputs=[dropdown], outputs=[
|
73 |
|
74 |
-
iface.load(on_load, outputs=[
|
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()
|