|
import gradio as gr |
|
from gradio_leaderboard import Leaderboard, ColumnFilter, SelectColumns |
|
|
|
|
|
from src.populate import load_tables |
|
|
|
from src.config import ( |
|
file_path, |
|
model_types, |
|
hidden_tabs, |
|
INTRODUCTION_TEXT, |
|
TITLE, |
|
INFO_BENCHMARK_TASK, |
|
INFO_SCORE_CALCULATION, |
|
INFO_GOTO_SAHABAT_AI, |
|
CITATIONS |
|
) |
|
|
|
|
|
|
|
demo = gr.Blocks() |
|
with demo: |
|
gr.HTML(TITLE) |
|
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text") |
|
|
|
|
|
with gr.Tabs(elem_classes="tab-buttons") as tabs: |
|
tables = load_tables(file_path) |
|
for model_type in model_types: |
|
with gr.TabItem(model_type, elem_id="llm-benchmark-tab-table", id=model_type): |
|
for i, t in enumerate(tables): |
|
if (model_type, t["name"]) in hidden_tabs: |
|
continue |
|
with gr.TabItem(t["name"], elem_id="llm-benchmark-tab-table", id=i): |
|
table_df = t["table"][t["table"]["Type"] == model_type] |
|
table_df = table_df.dropna(axis=1, how='all') |
|
leaderboard = Leaderboard( |
|
value=table_df, |
|
search_columns=["Model"], |
|
filter_columns=[ |
|
ColumnFilter(table_df["Size"].name, type="checkboxgroup", label="Model sizes"), |
|
], |
|
hide_columns=t["hidden_col"], |
|
interactive=False, |
|
) |
|
|
|
|
|
with gr.Row(): |
|
with gr.Accordion("๐ Benchmark Tasks", open=False): |
|
gr.Markdown(INFO_BENCHMARK_TASK, elem_classes="markdown-text") |
|
|
|
with gr.Row(): |
|
with gr.Accordion("๐งฎ Score Calculation", open=False): |
|
gr.Markdown(INFO_SCORE_CALCULATION, elem_classes="markdown-text") |
|
|
|
with gr.Row(): |
|
with gr.Accordion("๐ค About Sahabat-AI", open=False): |
|
gr.Markdown(INFO_GOTO_SAHABAT_AI, elem_classes="markdown-text") |
|
|
|
with gr.Row(): |
|
with gr.Accordion("๐ Citations", open=False): |
|
gr.Markdown(CITATIONS, elem_classes="markdown-text") |
|
|
|
|
|
demo.launch() |
|
|