Spaces:
Running
Running
import gradio as gr | |
from .config import * | |
from .leaderboard import * | |
from .messages import * | |
with gr.Blocks() as leaderboard: | |
gr.Markdown(LDESC) | |
df = gr.Dataframe( | |
headers=['Rank', 'Model', 'Score', 'Total Votes'], | |
interactive=False, | |
wrap=True, | |
column_widths=['80px', '200px', '100px', '100px'] | |
) | |
reloadbtn = gr.Button("π Refresh") | |
reveal_prelim = gr.Checkbox( | |
label="Show preliminary results", | |
info="Include models with few votes", | |
value=True | |
) | |
def update_leaderboard(reveal_prelim): | |
return get_leaderboard(reveal_prelim) | |
# Update on checkbox changes | |
reveal_prelim.change( | |
update_leaderboard, | |
inputs=[reveal_prelim], | |
outputs=[df] | |
) | |
# Update on refresh button click | |
reloadbtn.click( | |
update_leaderboard, | |
inputs=[reveal_prelim], | |
outputs=[df] | |
) | |
# Initial load | |
leaderboard.load( | |
update_leaderboard, | |
inputs=[reveal_prelim], | |
outputs=[df] | |
) | |