import gradio as gr from src.styles import custom_css, polygon_svg from src.structures.all_structure import ( ALL_ACCS, STYLED ) from src.structures.pes_structure import (PES_ACCS, ORDER_LIST, DATA_TYPES, COLUMN_HEADERS, STYLED_PES_ACCS, filter_data, filter_columns, ) from src.abouts import * from src.structures.lek_structure import ( LEK_ACCS, ORDER_LIST_LEK, COLUMN_HEADERS_LEK, DATA_TYPES_LEK, filter_columns_lek, LEK_ACCS_EN, ORDER_LIST_LEK_EN, COLUMN_HEADERS_LEK_EN, DATA_TYPES_LEK_EN, ) from src.structures.ldek_structure import ( LDEK_ACCS, ORDER_LIST_LDEK, COLUMN_HEADERS_LDEK, DATA_TYPES_LDEK, filter_columns_ldek, LDEK_EN_ACCS, ORDER_LIST_LDEK_EN, COLUMN_HEADERS_LDEK_EN, DATA_TYPES_LDEK_EN ) global data_component global data_component_ldek main = gr.Blocks(css=custom_css) with main: with gr.Row(): with gr.Column(): gr.HTML(polygon_svg) with gr.Column(): gr.HTML(HEADER_TITLE) with gr.Tabs(elem_classes="tab-buttons") as tabs: with gr.TabItem("🥇 Polish Medical Exams"): gr.Markdown(LEADERBOARD_DESC) data_component = gr.components.Dataframe( value=STYLED, type="pandas", datatype=["markdown"], interactive=False, visible=True, show_label=True, column_widths=[400,150,150,150,150] ) with gr.TabItem("🏥 PES"): gr.Markdown(PES_DESC) # 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=STYLED_PES_ACCS, headers=COLUMN_HEADERS, type="pandas", datatype=DATA_TYPES, interactive=False, visible=True, # column_widths=[400] + [250] * (len(COLUMN_HEADERS) - 1) ) def update_dataframe(selected_columns): return filter_columns(selected_columns) columns_selector.change(update_dataframe, inputs=columns_selector, outputs=data_component) with gr.TabItem("🩺 LEK"): gr.Markdown(LEK_DESC) data_component_ldek = gr.components.Dataframe( value=LEK_ACCS, headers=COLUMN_HEADERS_LEK, type="pandas", datatype=DATA_TYPES_LEK, interactive=False, visible=True, column_widths=[400] + [180] +[155] * 22 ) gr.Markdown(LEK_DESC_EN) data_component_ldek = gr.components.Dataframe( value=LEK_ACCS_EN, headers=COLUMN_HEADERS_LEK_EN, type="pandas", datatype=DATA_TYPES_LEK_EN, interactive=False, visible=True, column_widths=[400] + [180] +[155] * 22 ) with gr.TabItem("🦷 LDEK"): gr.Markdown(LDEK_DESC) data_component_ldek = gr.components.Dataframe( value=LDEK_ACCS, headers=COLUMN_HEADERS_LDEK, type="pandas", datatype=DATA_TYPES_LDEK, interactive=False, visible=True, column_widths=[400] + [180] + [155] * 22 ) gr.Markdown(LDEK_DESC_EN) data_component_ldek = gr.components.Dataframe( value=LDEK_EN_ACCS, headers=COLUMN_HEADERS_LDEK_EN, type="pandas", datatype=DATA_TYPES_LDEK_EN, interactive=False, visible=True, column_widths=[400] + [180] + [155] * 22 ) with gr.Column(): with gr.Accordion("📙 Citation", open=False): citation_button = gr.Textbox( label=CITATION_LABEL, value=CITATION_CONTENT, lines=20, elem_id="citation-button", show_copy_button=True, ) if __name__ == "__main__": main.launch()