import gradio as gr from utils import get_leaderboard_data, SUPER_GROUPS, MODEL_GROUPS import os from constants import * # Get the directory of the current script current_dir = os.path.dirname(os.path.abspath(__file__)) # Construct the path to the CSS file css_file = os.path.join(current_dir, "static", "css", "style.css") # Read the CSS file with open(css_file, "r") as f: css = f.read() def update_leaderboard(selected_super_group, selected_model_group): headers, data = get_leaderboard_data(selected_super_group, selected_model_group) return gr.Dataframe( value=data, headers=headers, datatype=["str"] + ["number"] * (len(headers) - 1), ) with gr.Blocks(css=css) as block: gr.Markdown( LEADERBOARD_INTRODUCTION ) with gr.Tabs(elem_classes="tab-buttons") as tabs: with gr.TabItem("📊 MEGA-Bench", elem_id="qa-tab-table1", id=1): with gr.Row(): with gr.Accordion("Citation", open=False): citation_button = gr.Textbox( value=CITATION_BUTTON_TEXT, label=CITATION_BUTTON_LABEL, elem_id="citation-button", lines=10, ) gr.Markdown( TABLE_INTRODUCTION ) with gr.Row(): super_group_selector = gr.Radio( choices=list(SUPER_GROUPS.keys()), label="Select a dimension to display breakdown results. We use different column colors to distinguish the overall benchmark scores and breakdown results.", value=list(SUPER_GROUPS.keys())[0] ) model_group_selector = gr.Radio( choices=list(MODEL_GROUPS.keys()), label="Select a model group", value="All" ) initial_headers, initial_data = get_leaderboard_data(list(SUPER_GROUPS.keys())[0], "All") gr.Markdown( "**Table 1: MEGA-Bench full results.**
The Core set contains $N_{\\text{core}} = 440$ tasks evaluated by rule-based metrics, and the Open-ended set contains $N_{\\text{open}} = 65$ tasks evaluated by a VLM judge (we use GPT-4o-0806).
$\\text{Overall} \\ = \\ \\frac{\\max(\\text{Core w/o CoT}, \\ \\text{Core w/ CoT}) \\ \\cdot \\ N_{\\text{core}} \\ + \\ \\text{Open-ended} \\ \\cdot \\ N_{\\text{open}}}{N_{\\text{core}} \\ + \\ N_{\\text{open}}}$", elem_classes="table-caption", latex_delimiters=[ {"left": "$", "right": "$", "display": False }], ) data_component = gr.Dataframe( value=initial_data, headers=initial_headers, datatype=["str"] + ["number"] * (len(initial_headers) - 1), interactive=False, elem_classes="custom-dataframe", max_height=1200, ) refresh_button = gr.Button("Refresh") refresh_button.click(fn=update_leaderboard, inputs=[super_group_selector, model_group_selector], outputs=[data_component]) super_group_selector.change(fn=update_leaderboard, inputs=[super_group_selector, model_group_selector], outputs=[data_component]) model_group_selector.change(fn=update_leaderboard, inputs=[super_group_selector, model_group_selector], outputs=[data_component]) with gr.TabItem("📝 Data Information", elem_id="qa-tab-table2", id=2): gr.Markdown(DATA_INFO, elem_classes="markdown-text") with gr.TabItem("🚀 Submit", elem_id="submit-tab", id=3): with gr.Row(): gr.Markdown(SUBMIT_INTRODUCTION, elem_classes="markdown-text") if __name__ == "__main__": block.launch(share=True)