Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from src.styles import custom_css | |
| from src.structures.all_structure import ( | |
| ALL_ACCS, | |
| STYLED | |
| # ALL_DATA_TYPES, | |
| # ALL_ORDER_LIST | |
| ) | |
| from src.structures.pes_structure import (PES_ACCS, | |
| ORDER_LIST, | |
| DATA_TYPES, | |
| COLUMN_HEADERS, | |
| 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 | |
| ) | |
| from src.structures.ldek_structure import ( | |
| LDEK_ACCS, | |
| ORDER_LIST_LDEK, | |
| COLUMN_HEADERS_LDEK, | |
| DATA_TYPES_LDEK, | |
| filter_columns_ldek | |
| ) | |
| global data_component | |
| global data_component_ldek | |
| 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.TabItem("π₯ Medical leaderboard"): | |
| 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=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("π¦· LDEK"): | |
| gr.Markdown(LDEK_DESC) | |
| columns_selector = gr.CheckboxGroup( | |
| choices=ORDER_LIST_LDEK, | |
| label="Select columns to display", | |
| value=ORDER_LIST_LDEK, | |
| ) | |
| 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] + [155] * 23 | |
| ) | |
| def update_dataframe(selected_columns): | |
| return filter_columns_ldek(selected_columns) | |
| columns_selector.change(update_dataframe, inputs=columns_selector, outputs=data_component_ldek) | |
| with gr.TabItem("π©Ί LEK"): | |
| gr.Markdown(LEK_DESC) | |
| columns_selector = gr.CheckboxGroup( | |
| choices=ORDER_LIST_LEK, | |
| label="Select columns to display", | |
| value=ORDER_LIST_LEK, | |
| ) | |
| 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] + [155] * 23 | |
| ) | |
| def update_dataframe(selected_columns): | |
| return filter_columns_lek(selected_columns) | |
| columns_selector.change(update_dataframe, inputs=columns_selector, outputs=data_component_ldek) | |
| 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() | |