|
import gradio as gr |
|
import pandas as pd |
|
import numpy as np |
|
|
|
|
|
df = pd.read_csv('passk.csv') |
|
|
|
|
|
languages = sorted(set([d.split('-')[1] for d in df['Dataset']])) |
|
models = sorted(set(['-'.join(d.split('-')[2:-2]) for d in df['Dataset']])) |
|
|
|
|
|
model_to_friendly = { |
|
"starcoder2_15b": "StarCoder2-15B", |
|
"deepseekcoder_v2lite": "DeepSeekCoder2-Lite" |
|
} |
|
|
|
|
|
def get_friendly_name(model): |
|
return model_to_friendly.get(model, model) |
|
|
|
|
|
pivot = df.pivot(index='Dataset', columns='Dataset', values='Estimate') |
|
pivot.index = ['-'.join(i.split('-')[2:-2]) for i in pivot.index] |
|
pivot.columns = [i.split('-')[1] for i in pivot.columns] |
|
|
|
|
|
def update_table(selected_languages): |
|
if not selected_languages: |
|
return np.full((len(models), len(languages)), "-").tolist() |
|
|
|
display_data = pivot[selected_languages].replace(np.nan, "-") |
|
display_data = display_data.applymap(lambda x: f"{x:.3f}" if isinstance(x, (int, float)) else x) |
|
display_data.index = [get_friendly_name(model) for model in display_data.index] |
|
return display_data.values.tolist() |
|
|
|
|
|
with gr.Blocks() as app: |
|
gr.Markdown("# Model Leaderboard") |
|
|
|
with gr.Row(): |
|
language_checkboxes = gr.CheckboxGroup(choices=languages, label="Select Languages", value=languages) |
|
|
|
table = gr.Dataframe( |
|
headers=[lang.capitalize() for lang in languages], |
|
row_headers=[get_friendly_name(model) for model in models], |
|
col_count=(lambda: len(languages)), |
|
interactive=False |
|
) |
|
|
|
language_checkboxes.change(update_table, inputs=[language_checkboxes], outputs=[table]) |
|
|
|
|
|
if __name__ == "__main__": |
|
app.launch() |