zsss0316 commited on
Commit
3ab0b46
·
verified ·
1 Parent(s): 4368125

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +107 -118
index.html CHANGED
@@ -1,129 +1,118 @@
1
  <!DOCTYPE html>
2
  <html lang="en">
3
  <head>
4
- <meta charset="utf-8">
5
- <title>Infernet Econometrics Benchmark Leaderboard</title>
6
- <script type="module" crossorigin src="https://cdn.jsdelivr.net/npm/@gradio/lite/dist/lite.js"></script>
7
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@gradio/lite/dist/lite.css"/>
8
- <style>
9
- body { margin:0; background-color:#f7f8fa; }
10
- </style>
 
 
 
 
 
11
  </head>
12
  <body>
13
- <gradio-lite>
14
- import gradio as gr
15
- import pandas as pd
16
-
17
- CSS = """
18
- .gradio-container {
19
- max-width: 1280px !important;
20
- margin: 24px auto !important;
21
- padding: 0 20px !important;
22
- background-color: #ffffff;
23
- border-radius: 12px;
24
- box-shadow: 0 2px 12px rgba(0,0,0,0.06);
25
- }
26
- .stat-card {
27
- background: linear-gradient(135deg,#f0f4f9,#ffffff);
28
- padding:20px 12px;
29
- border-radius:12px;
30
- text-align:center;
31
- border:1px solid #e2e8f0;
32
- box-shadow:0 1px 4px rgba(0,0,0,0.04);
33
- }
34
- .stat-val {
35
- font-size:28px;
36
- font-weight:700;
37
- color:#2b549c;
38
- margin-bottom:4px;
 
 
 
 
39
  }
40
- .stat-label {
41
- font-size:14px;
42
- color:#475569;
43
- }
44
- h1 {
45
- color:#1e293b;
46
- }
47
- """
48
-
49
- def load_data():
50
- df = pd.read_csv("results.csv")
51
- df["Overall Score"] = df[["Compilation %","Replication %","Direction %"]].mean(axis=1).round(2)
52
- return df.sort_values("Overall Score", ascending=False).reset_index(drop=True)
53
-
54
- with gr.Blocks(css=CSS, title="Infernet Leaderboard") as demo:
55
- gr.HTML("""
56
- <div style="text-align:center;padding-top:28px;padding-bottom:12px;">
57
- <h1 style="margin:0 0 8px 0;color:#0f172a;">🏆 Infernet Econometrics Benchmark Leaderboard</h1>
58
- <p style="color:#475569;font-size:15px;">
59
- CamoAiLab, HKU&nbsp;&nbsp;|&nbsp;&nbsp;
60
- Dataset: <a target="_blank" href="https://huggingface.co/datasets/CamoAiLab/Infernet">CamoAiLab/Infernet</a>
61
- &nbsp;&nbsp;Paper: <a target="_blank" href="https://arxiv.org/abs/2506.00856">arXiv:2506.00856</a>
62
- </p>
63
- </div>
64
- """)
65
-
66
- df_init = load_data()
67
-
68
- with gr.Row():
69
- with gr.Column():
70
- gr.HTML(f'<div class="stat-card"><div class="stat-val">{len(df_init)}</div><div class="stat-label">Total Evaluated Models</div></div>')
71
- with gr.Column():
72
- gr.HTML(f'<div class="stat-card"><div class="stat-val">{df_init["Overall Score"].max()}%</div><div class="stat-label">Best Overall Score</div></div>')
73
- with gr.Column():
74
- gr.HTML(f'<div class="stat-card"><div class="stat-val">1000</div><div class="stat-label">Test Instances</div></div>')
75
-
76
- gr.Markdown("<hr style='margin:24px 0'>")
77
-
78
- with gr.Tabs():
79
- with gr.TabItem("📊 Main Leaderboard"):
80
- search_box = gr.Textbox(
81
- placeholder="🔍 Search model name ...",
82
- label=None,
83
- show_label=False
84
- )
85
- table = gr.Dataframe(
86
- value=df_init,
87
- interactive=False,
88
- wrap=True
89
- )
90
 
91
- def filter_data(query):
92
- full = load_data()
93
- if not query:
94
- return full
95
- return full[full["Model"].str.contains(query, case=False)]
96
-
97
- search_box.change(filter_data, inputs=search_box, outputs=table)
98
-
99
- with gr.TabItem("📖 Metric Definitions"):
100
- gr.Markdown("""
101
- ### Evaluation Metrics Explanation
102
-
103
- 1. **Compilation %**
104
- Code compilation success rate: proportion of generated econometric code that runs without runtime errors.
105
-
106
- 2. **Replication % (Partial Replication)**
107
- Partial replication rate: proportion of tasks where model partially reproduces target estimation outputs.
108
-
109
- 3. **Direction % (Correct Coefficient Direction)**
110
- Core metric: accuracy for predicting correct positive/negative sign of target regression coefficients.
111
-
112
- 4. **Overall Score**
113
- Simple average of above three metrics for comprehensive comparison.
114
- """)
115
-
116
- with gr.TabItem("✉️ Submit Results"):
117
- gr.Markdown("""
118
- To submit your model results:
119
- 1. Open a **Discussion** on dataset page: [CamoAiLab/Infernet](https://huggingface.co/datasets/CamoAiLab/Infernet)
120
- 2. Provide model name, scores and reproduction evidence/logs.
121
- 3. After verification, we will update the leaderboard.
122
- """)
123
 
124
- demo
125
- </gradio-lite>
 
 
 
 
 
 
 
 
 
 
 
126
 
127
- <gradio-file name="results.csv" url="./results.csv"/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  </body>
129
  </html>
 
1
  <!DOCTYPE html>
2
  <html lang="en">
3
  <head>
4
+ <meta charset="UTF-8">
5
+ <title>Infernet Econometrics Benchmark Leaderboard</title>
6
+ <style>
7
+ body {font-family: Arial; max-width:1100px; margin:30px auto; padding:0 20px;}
8
+ table {width:100%; border-collapse: collapse; margin:15px 0 40px;}
9
+ th,td {border:1px solid #ccc; padding:10px; text-align:left;}
10
+ th {background:#1f77b4; color:white;}
11
+ .tab{margin:8px 4px;padding:8px 16px;border:1px solid #999;background:#eee;cursor:pointer;}
12
+ .tab.active{background:#1f77b4;color:white;border-color:#1f77b4;}
13
+ .panel{display:none;}
14
+ .panel.show{display:block;}
15
+ </style>
16
  </head>
17
  <body>
18
+ <h1>🏆 Infernet Econometrics Benchmark Leaderboard</h1>
19
+ <p><strong>CamoAiLab | HKU CAMO</strong><br>
20
+ Dataset: <a href="https://huggingface.co/datasets/CamoAiLab/Infernet">CamoAiLab/Infernet</a>
21
+ </p>
22
+
23
+ <div>
24
+ <button class="tab active" onclick="switchTab(0)">1. Compilation Success Rate</button>
25
+ <button class="tab" onclick="switchTab(1)">2. Partial Replication Rate</button>
26
+ <button class="tab" onclick="switchTab(2)">3. Correct Coefficient Direction</button>
27
+ </div>
28
+
29
+ <div class="panel show" id="panel-compile"></div>
30
+ <div class="panel" id="panel-rep"></div>
31
+ <div class="panel" id="panel-dir"></div>
32
+
33
+ <h3>📌 Metric Definition</h3>
34
+ <ul>
35
+ <li><strong>Compilation Success:</strong> Generated code runs without runtime errors.</li>
36
+ <li><strong>Partial Replication:</strong> Partially reproduce target estimation results.</li>
37
+ <li><strong>Correct Coefficient Direction:</strong> Correct sign of estimated coefficients.</li>
38
+ </ul>
39
+
40
+ <script>
41
+ const panels = document.querySelectorAll(".panel");
42
+ const tabs = document.querySelectorAll(".tab");
43
+ function switchTab(idx){
44
+ panels.forEach(p=>p.classList.remove("show"));
45
+ tabs.forEach(t=>t.classList.remove("active"));
46
+ panels[idx].classList.add("show");
47
+ tabs[idx].classList.add("active");
48
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
+ function parseCSV(text) {
51
+ text = text.replace(/\r\n/g,"\n").replace(/\r/g,"\n");
52
+ const lines = text.trim().split("\n").filter(line=>line.trim()!=='');
53
+ const headers = lines[0].split(",").map(h=>h.trim());
54
+ const rows = [];
55
+ for(let i=1;i<lines.length;i++){
56
+ const vals = lines[i].split(",").map(v=>v.trim());
57
+ const obj = {};
58
+ headers.forEach((h,idx)=>{
59
+ obj[h] = vals[idx];
60
+ });
61
+ rows.push(obj);
62
+ }
63
+ return rows;
64
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
+ function buildTable(title, data, sortKey){
67
+ const sorted = [...data].sort((a,b)=> Number(b[sortKey]) - Number(a[sortKey]));
68
+ let html = `<h3>${title}</h3><table><tr><th>Rank</th><th>Model</th><th>${sortKey}</th></tr>`;
69
+ sorted.forEach((row,i)=>{
70
+ html += `<tr>
71
+ <td>${i+1}</td>
72
+ <td>${row["Model ID"]}</td>
73
+ <td>${row[sortKey]}%</td>
74
+ </tr>`;
75
+ })
76
+ html += "</table>";
77
+ return html;
78
+ }
79
 
80
+ // 读取space本地csv,不再跨域访问dataset
81
+ const csvUrl = "./results.csv";
82
+
83
+ async function loadData(){
84
+ try {
85
+ const res = await fetch(csvUrl);
86
+ if(!res.ok) throw new Error(`HTTP ${res.status}`);
87
+ const csvText = await res.text();
88
+ const data = parseCSV(csvText);
89
+
90
+ if(data.length ===0){
91
+ document.body.insertAdjacentHTML("beforeend",`<p style="color:red">Warning: CSV parsed zero rows</p>`);
92
+ return;
93
+ }
94
+
95
+ document.getElementById("panel-compile").innerHTML = buildTable(
96
+ "Ranked by Code Compilation Success",
97
+ data,
98
+ "Compilation Success (%)"
99
+ );
100
+ document.getElementById("panel-rep").innerHTML = buildTable(
101
+ "Ranked by Partial Replication Rate",
102
+ data,
103
+ "Partial Replication (%)"
104
+ );
105
+ document.getElementById("panel-dir").innerHTML = buildTable(
106
+ "Ranked by Correct Coefficient Direction",
107
+ data,
108
+ "Correct Coefficient Direction (%)"
109
+ );
110
+ } catch(err){
111
+ console.error("load csv error",err);
112
+ document.body.insertAdjacentHTML("beforeend",`<p style='color:red'>Failed to load ranking data: ${err.message}</p>`);
113
+ }
114
+ }
115
+ loadData();
116
+ </script>
117
  </body>
118
  </html>