import gradio as gr from leaderboard.dataset import get_leaderboard_df from leaderboard.submission import submit_model def display_leaderboard(): df = get_leaderboard_df() return df with gr.Blocks() as app: gr.Markdown("# human_methylation_bench_ver1 Leaderboard") with gr.Tab("Leaderboard"): leaderboard_df = gr.DataFrame( value=display_leaderboard(), headers=["Model Name", "Score (relative_error_loss)", "Rank"], interactive=False, label="Leaderboard", ) with gr.Tab("Submit Model"): model_name_input = gr.Textbox(label="Model Name", placeholder="e.g. My Great Model") model_url_input = gr.Textbox( label="Hugging Face Model Joblib URL", placeholder="e.g. https://huggingface.co/username/model/resolve/main/model.joblib", ) submit_button = gr.Button("Submit") submission_output = gr.DataFrame( headers=["Model Name", "Score (relative_error_loss)", "Rank"], interactive=False, label="Updated Leaderboard" ) submit_button.click(submit_model, inputs=[model_name_input, model_url_input], outputs=submission_output) if __name__ == "__main__": app.launch()