Update index.html
Browse files- index.html +56 -105
index.html
CHANGED
|
@@ -1,118 +1,69 @@
|
|
| 1 |
-
<
|
| 2 |
-
<html lang="en">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
-
<title>Infernet
|
|
|
|
|
|
|
|
|
|
| 6 |
<style>
|
| 7 |
-
body {
|
| 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 |
-
<
|
| 19 |
-
<
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
<
|
| 36 |
-
<
|
| 37 |
-
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 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 |
-
|
| 67 |
-
|
| 68 |
-
|
| 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>
|
|
|
|
| 1 |
+
<html>
|
|
|
|
| 2 |
<head>
|
| 3 |
<meta charset="UTF-8">
|
| 4 |
+
<title>Infernet Leaderboard</title>
|
| 5 |
+
<!-- 加载 Gradio-lite 引擎 -->
|
| 6 |
+
<script type="module" 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 { background-color: #f9fafb; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
</style>
|
| 11 |
</head>
|
| 12 |
<body>
|
| 13 |
+
<gradio-lite>
|
| 14 |
+
<!-- 这里编写您的 Python 代码 -->
|
| 15 |
+
<gradio-file name="app.py" entrypoint>
|
| 16 |
+
import gradio as gr
|
| 17 |
+
import pandas as pd
|
| 18 |
+
import io
|
| 19 |
|
| 20 |
+
# 1. 模拟数据(您也可以在此处直接修改数据 )
|
| 21 |
+
data_csv = """Model,Compilation %,Replication %,Direction %
|
| 22 |
+
Econometrics-Agent (Ours),92.5,88.0,85.0
|
| 23 |
+
GPT-4o,98.0,82.5,75.1
|
| 24 |
+
Claude 3.5 Sonnet,96.2,80.4,72.8
|
| 25 |
+
Llama-3-70B,85.0,65.0,60.5
|
| 26 |
+
"""
|
| 27 |
|
| 28 |
+
def load_data():
|
| 29 |
+
df = pd.read_csv(io.StringIO(data_csv))
|
| 30 |
+
df["Overall Score"] = df[["Compilation %", "Replication %", "Direction %"]].mean(axis=1).round(2)
|
| 31 |
+
return df.sort_values("Overall Score", ascending=False)
|
| 32 |
|
| 33 |
+
# 2. 界面构建
|
| 34 |
+
with gr.Blocks(title="Infernet Leaderboard") as demo:
|
| 35 |
+
gr.HTML("<h1 style='text-align: center; color: #1f2937;'>🏆 Infernet Econometrics Leaderboard</h1>")
|
| 36 |
+
gr.HTML("<p style='text-align: center; color: #6b7280;'>CamoAiLab | Free Browser-based Edition</p>")
|
| 37 |
+
|
| 38 |
+
with gr.Row():
|
| 39 |
+
df_init = load_data()
|
| 40 |
+
gr.Number(label="Total Models", value=len(df_init), interactive=False)
|
| 41 |
+
gr.Number(label="Best Overall (%)", value=df_init["Overall Score"].max(), interactive=False)
|
| 42 |
|
| 43 |
+
gr.Markdown("---")
|
| 44 |
+
|
| 45 |
+
with gr.Tabs():
|
| 46 |
+
with gr.TabItem("📊 Leaderboard"):
|
| 47 |
+
search = gr.Textbox(placeholder="🔍 Search model...", label=None, show_label=False)
|
| 48 |
+
table = gr.Dataframe(value=df_init, interactive=False)
|
| 49 |
+
|
| 50 |
+
def filter_table(query):
|
| 51 |
+
full_df = load_data()
|
| 52 |
+
if not query: return full_df
|
| 53 |
+
return full_df[full_df["Model"].str.contains(query, case=False)]
|
| 54 |
+
|
| 55 |
+
search.change(fn=filter_table, inputs=search, outputs=table)
|
| 56 |
|
| 57 |
+
with gr.TabItem("📖 Definitions"):
|
| 58 |
+
gr.Markdown("""
|
| 59 |
+
### 计量经济学评测指标
|
| 60 |
+
- **Compilation %**: 代码运行成功率。
|
| 61 |
+
- **Replication %**: 统计结果复现率。
|
| 62 |
+
- **Direction %**: **核心指标**。系数正负号正确率。
|
| 63 |
+
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
+
demo.launch()
|
| 66 |
+
</gradio-file>
|
| 67 |
+
</gradio-lite>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
</body>
|
| 69 |
+
</html>
|