Spaces:
Runtime error
Runtime error
| import gradio as gr, pandas as pd, datetime as dt | |
| from huggingface_hub import hf_hub_download | |
| DATASET = "Mdrnfox/peft-bench-metrics" | |
| PQ_PATH = "data/peft_bench.parquet" | |
| def load_table(): | |
| local = hf_hub_download(DATASET, PQ_PATH, repo_type="dataset") | |
| df_long = pd.read_parquet(local) | |
| wide = ( | |
| df_long | |
| .query("metric != 'alias'") # drop alias | |
| .pivot_table(index=["model_id", "task"], | |
| columns=["metric", "aggregation"], | |
| values="value") | |
| .reset_index() | |
| .sort_values(["task", "model_id"]) | |
| ) | |
| wide.columns = ['_'.join(filter(None, map(str, col))).strip() for col in wide.columns.values] | |
| return wide | |
| def refresh(): | |
| return gr.DataFrame.update(value=load_table(), | |
| headers=None), f"Last updated {dt.datetime.utcnow():%Y-%m-%d %H:%M UTC}" | |
| with gr.Blocks(title="PEFT-Bench") as demo: | |
| gr.Markdown("# PEFT-Bench Leaderboard") | |
| df = gr.DataFrame(value=load_table(), interactive=False, wrap=True) | |
| t = gr.Markdown(f"Last updated {dt.datetime.utcnow():%Y-%m-%d %H:%M UTC}") | |
| gr.Button("↻ Refresh").click(refresh, outputs=[df, t]) | |
| demo.launch() | |