Update index.html
Browse files- index.html +41 -35
index.html
CHANGED
|
@@ -2,66 +2,72 @@
|
|
| 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: #
|
|
|
|
| 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 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
""
|
|
|
|
| 27 |
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
# 2. 界面构建
|
| 34 |
with gr.Blocks(title="Infernet Leaderboard") as demo:
|
| 35 |
-
gr.HTML("<h1 style='text-align: center; color: #
|
| 36 |
-
gr.HTML("<p style='text-align: center; color: #
|
| 37 |
|
| 38 |
with gr.Row():
|
| 39 |
-
|
| 40 |
-
gr.Number(label="
|
| 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 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
|
|
|
| 54 |
|
| 55 |
-
search.change(fn=
|
| 56 |
|
| 57 |
-
with gr.TabItem("📖 Definitions"):
|
| 58 |
gr.Markdown("""
|
| 59 |
-
### 计量经济学评测指标
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
|
|
|
| 63 |
""")
|
| 64 |
|
|
|
|
|
|
|
|
|
|
| 65 |
demo.launch()
|
| 66 |
</gradio-file>
|
| 67 |
</gradio-lite>
|
|
|
|
| 2 |
<head>
|
| 3 |
<meta charset="UTF-8">
|
| 4 |
<title>Infernet Leaderboard</title>
|
|
|
|
| 5 |
<script type="module" src="https://cdn.jsdelivr.net/npm/@gradio/lite/dist/lite.js"></script>
|
| 6 |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@gradio/lite/dist/lite.css" />
|
| 7 |
<style>
|
| 8 |
+
body { background-color: #f3f4f6; padding-top: 20px; }
|
| 9 |
+
.gradio-container { border-radius: 15px !important; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1 ) !important; }
|
| 10 |
</style>
|
| 11 |
</head>
|
| 12 |
<body>
|
| 13 |
<gradio-lite>
|
|
|
|
| 14 |
<gradio-file name="app.py" entrypoint>
|
| 15 |
import gradio as gr
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
# 1. 核心数据(原生列表格式,无需 pandas)
|
| 18 |
+
# 格式:[模型名, 编译%, 复现%, 方向%, 综合分]
|
| 19 |
+
RAW_DATA = [
|
| 20 |
+
["Econometrics-Agent (Ours)", 92.5, 88.0, 85.0, 88.5],
|
| 21 |
+
["GPT-4o", 98.0, 82.5, 75.1, 85.2],
|
| 22 |
+
["Claude 3.5 Sonnet", 96.2, 80.4, 72.8, 83.1],
|
| 23 |
+
["Llama-3-70B", 85.0, 65.0, 60.5, 70.2]
|
| 24 |
+
]
|
| 25 |
|
| 26 |
+
HEADERS = ["Model", "Compilation %", "Replication %", "Direction %", "Overall Score"]
|
| 27 |
+
|
| 28 |
+
def get_leaderboard(query=""):
|
| 29 |
+
# 过滤与排序逻辑
|
| 30 |
+
filtered = [row for row in RAW_DATA if query.lower() in row[0].lower()]
|
| 31 |
+
# 按最后一列(综合分)降序排列
|
| 32 |
+
sorted_data = sorted(filtered, key=lambda x: x[4], reverse=True)
|
| 33 |
+
return sorted_data
|
| 34 |
|
| 35 |
# 2. 界面构建
|
| 36 |
with gr.Blocks(title="Infernet Leaderboard") as demo:
|
| 37 |
+
gr.HTML("<h1 style='text-align: center; color: #111827;'>🏆 Infernet Econometrics Leaderboard</h1>")
|
| 38 |
+
gr.HTML("<p style='text-align: center; color: #4b5563; margin-bottom: 20px;'>CamoAiLab | Browser-based Empirical AI Benchmark</p>")
|
| 39 |
|
| 40 |
with gr.Row():
|
| 41 |
+
gr.Number(label="Total Models", value=len(RAW_DATA), interactive=False)
|
| 42 |
+
gr.Number(label="Best Score (%)", value=max(row[4] for row in RAW_DATA), interactive=False)
|
|
|
|
| 43 |
|
| 44 |
gr.Markdown("---")
|
| 45 |
|
| 46 |
with gr.Tabs():
|
| 47 |
+
with gr.TabItem("📊 Main Leaderboard"):
|
| 48 |
+
search = gr.Textbox(placeholder="🔍 Search for a model...", label=None, show_label=False)
|
| 49 |
+
# 使用原生列表渲染表格
|
| 50 |
+
table = gr.Dataframe(
|
| 51 |
+
headers=HEADERS,
|
| 52 |
+
value=get_leaderboard(),
|
| 53 |
+
datatype=["str", "number", "number", "number", "number"],
|
| 54 |
+
interactive=False
|
| 55 |
+
)
|
| 56 |
|
| 57 |
+
search.change(fn=get_leaderboard, inputs=search, outputs=table)
|
| 58 |
|
| 59 |
+
with gr.TabItem("📖 Metric Definitions"):
|
| 60 |
gr.Markdown("""
|
| 61 |
+
### 🔍 计量经济学评测指标说明
|
| 62 |
+
|
| 63 |
+
1. **Compilation %**: Agent 生成的代码是否能成功运行通过。
|
| 64 |
+
2. **Replication %**: 回归系数等结果与原始论文的重合度。
|
| 65 |
+
3. **Direction %**: **核心指标**。回归系数的正负号预测是否正确。
|
| 66 |
""")
|
| 67 |
|
| 68 |
+
with gr.TabItem("✉️ Submission"):
|
| 69 |
+
gr.Markdown("请将您的预测文件上传至 [CamoAiLab/Infernet](https://huggingface.co/datasets/CamoAiLab/Infernet ) 社区。")
|
| 70 |
+
|
| 71 |
demo.launch()
|
| 72 |
</gradio-file>
|
| 73 |
</gradio-lite>
|