Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from gradio_leaderboard import Leaderboard | |
| from pathlib import Path | |
| import pandas as pd | |
| from src.styles import custom_css | |
| from src.structures.leaderboard_structure import (LB_LLMZSZL, | |
| ORDER_LIST, | |
| DATA_TYPES, | |
| COLUMN_HEADERS, | |
| filter_data, | |
| filter_columns, | |
| ) | |
| from src.structures.gim import GIM_SCORES | |
| from src.structures.zaw import ZAW_SCORES | |
| from src.structures.mat import MAT_SCORES | |
| from src.structures.osm import OSM_SCORES | |
| global data_component | |
| from src.abouts import * | |
| main = gr.Blocks(css=custom_css) | |
| with main: | |
| with gr.Row(): | |
| with gr.Column(): | |
| image = gr.Image("src/images/logo.png", | |
| show_download_button=False, | |
| show_share_button=False, | |
| show_fullscreen_button=False, | |
| container=False) | |
| with gr.Column(): | |
| gr.HTML(HEADER_TITLE) | |
| with gr.Tabs(elem_classes="tab-buttons") as tabs: | |
| with gr.Tab("π LLMZSZL"): | |
| gr.Markdown("""## Overall scores""") | |
| # Checkbox to toggle column visibility | |
| columns_selector = gr.CheckboxGroup( | |
| choices=ORDER_LIST, | |
| label="Select columns to display", | |
| value=ORDER_LIST, | |
| ) | |
| # Dataframe component to display the leaderboard data | |
| data_component = gr.components.Dataframe( | |
| value=LB_LLMZSZL, | |
| headers=COLUMN_HEADERS, | |
| type="pandas", | |
| datatype=DATA_TYPES, | |
| interactive=False, | |
| visible=True, | |
| column_widths=[400, 200, 100, 120, 100] | |
| ) | |
| # def update_data(selected_columns, selected_languages): | |
| # return update_dataframe(selected_columns, selected_languages) | |
| def update_dataframe(selected_columns): | |
| return filter_columns(selected_columns) | |
| columns_selector.change(update_dataframe, inputs=columns_selector, outputs=data_component) | |
| # language_selector.change(update_data, inputs=[columns_selector, language_selector], outputs=data_component) | |
| with gr.Tab("π Middle School exam"): | |
| gr.Markdown(GIM_DESC) | |
| data_component = gr.components.Dataframe( | |
| value=GIM_SCORES, | |
| type="pandas", | |
| interactive=False, | |
| visible=True, | |
| datatype=["markdown"]+["number"]*18, | |
| column_widths=[400] + [80] * 18 | |
| ) | |
| with gr.Tab("π 8-grade exam"): | |
| gr.Markdown(OSM_DESC) | |
| data_component = gr.components.Dataframe( | |
| value=OSM_SCORES, | |
| type="pandas", | |
| interactive=False, | |
| visible=True, | |
| datatype=["markdown"]+["number"]*5, | |
| column_widths=[400] + [80] * 5 | |
| ) | |
| with gr.Tab("π High School exam"): | |
| gr.Markdown(MAT_DESC) | |
| data_component = gr.components.Dataframe( | |
| value=MAT_SCORES, | |
| type="pandas", | |
| interactive=False, | |
| visible=True, | |
| datatype=["markdown"]+["number"]*22, | |
| column_widths=[400] + [80] * 22 | |
| ) | |
| with gr.Tab("π Professional exam"): | |
| gr.Markdown(ZAW_DESC) | |
| data_component = gr.components.Dataframe( | |
| value=ZAW_SCORES, | |
| type="pandas", | |
| interactive=False, | |
| visible=True, | |
| datatype=["markdown"]+["number"]*12, | |
| column_widths=[400] + [80] * 12 | |
| ) | |
| with gr.Tab("π About"): | |
| gr.Markdown(ABOUT) | |
| with gr.Column(): | |
| with gr.Accordion("π Citation", open=False): | |
| citation_button = gr.Textbox( | |
| value="TEST", | |
| label="TEST_LABEL", | |
| lines=20, | |
| elem_id="citation-button", | |
| show_copy_button=True, | |
| ) | |
| if __name__ == "__main__": | |
| main.launch() | |