Spaces:
Running
Running
File size: 4,142 Bytes
c5afbf5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
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()
|