Mdrnfox commited on
Commit
bbaf3a3
·
verified ·
1 Parent(s): fe82024

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -0
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr, pandas as pd, datetime as dt
2
+ from huggingface_hub import hf_hub_download
3
+
4
+ DATASET = "Mdrnfox/peft-bench-metrics"
5
+ PQ_PATH = "data/peft_bench.parquet"
6
+
7
+ def load_table():
8
+ local = hf_hub_download(DATASET, PQ_PATH, repo_type="dataset")
9
+ df_long = pd.read_parquet(local)
10
+
11
+ wide = (
12
+ df_long
13
+ .query("metric != 'alias'") # drop alias
14
+ .pivot_table(index=["model_id", "task"],
15
+ columns="metric",
16
+ values="value")
17
+ .reset_index()
18
+ .sort_values(["task", "model_id"])
19
+ )
20
+ return wide
21
+
22
+ def refresh():
23
+ return gr.DataFrame.update(value=load_table(),
24
+ headers=None), f"Last updated {dt.datetime.utcnow():%Y-%m-%d %H:%M UTC}"
25
+
26
+ with gr.Blocks(title="PEFT-Bench") as demo:
27
+ gr.Markdown("# PEFT-Bench Leaderboard")
28
+ df = gr.DataFrame(value=load_table(), interactive=False, wrap=True)
29
+ t = gr.Markdown(f"Last updated {dt.datetime.utcnow():%Y-%m-%d %H:%M UTC}")
30
+ gr.Button("↻ Refresh").click(refresh, outputs=[df, t])
31
+
32
+ demo.launch()