import gradio as gr from .config import * from .leaderboard import * from .messages import * with gr.Blocks() as leaderboard: gr.Markdown(LDESC) table = gr.HTML() # Changed to HTML to support custom CSS reloadbtn = gr.Button("Refresh") with gr.Row(): with gr.Column(scale=1): reveal_prelim = gr.Checkbox( label="Reveal preliminary results", info="Show all models, including models with very few human ratings.", ) with gr.Column(scale=1): hide_battle_votes = gr.Checkbox( label="Hide Battle Mode votes", info="Exclude votes obtained through Battle Mode.", ) with gr.Column(scale=1): sort_by_elo = gr.Checkbox( label="Sort by Arena Score", info="Sort models by Arena Score instead of win rate", value=False, ) with gr.Column(scale=1): hide_proprietary = gr.Checkbox( label="Hide proprietary models", info="Show only open models", value=False, ) def update_leaderboard(*args): return get_leaderboard(*args) reveal_prelim.input(update_leaderboard, inputs=[reveal_prelim, hide_battle_votes, sort_by_elo, hide_proprietary], outputs=[table]) hide_battle_votes.input(update_leaderboard, inputs=[reveal_prelim, hide_battle_votes, sort_by_elo, hide_proprietary], outputs=[table]) sort_by_elo.input(update_leaderboard, inputs=[reveal_prelim, hide_battle_votes, sort_by_elo, hide_proprietary], outputs=[table]) hide_proprietary.input(update_leaderboard, inputs=[reveal_prelim, hide_battle_votes, sort_by_elo, hide_proprietary], outputs=[table]) leaderboard.load(update_leaderboard, inputs=[reveal_prelim, hide_battle_votes, sort_by_elo, hide_proprietary], outputs=[table]) reloadbtn.click(update_leaderboard, inputs=[reveal_prelim, hide_battle_votes, sort_by_elo, hide_proprietary], outputs=[table]) # gr.Markdown("DISCLAIMER: The licenses listed may not be accurate or up to date, you are responsible for checking the licenses before using the models. Also note that some models may have additional usage restrictions.")