zsss0316 commited on
Commit
c504454
·
verified ·
1 Parent(s): 5365303

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -73
app.py DELETED
@@ -1,73 +0,0 @@
1
- import gradio as gr
2
- import pandas as pd
3
- import os
4
-
5
- # --- 1. 视觉样式配置 ---
6
- CSS = """
7
- .gradio-container { max-width: 1200px !important; }
8
- .stat-card {
9
- background: #f8f9fa;
10
- padding: 15px;
11
- border-radius: 10px;
12
- text-align: center;
13
- border: 1px solid #e0e0e0;
14
- }
15
- .stat-val { font-size: 24px; font-weight: bold; color: #1f77b4; }
16
- """
17
-
18
- # --- 2. 数据加载逻辑 ---
19
- def load_data():
20
- # 优先读取本地 results.csv,如果没有则使用演示数据
21
- if os.path.exists("results.csv"):
22
- df = pd.read_csv("results.csv")
23
- else:
24
- df = pd.DataFrame([
25
- {"Model": "Econometrics-Agent (Ours)", "Compilation %": 92.5, "Replication %": 88.0, "Direction %": 85.0},
26
- {"Model": "GPT-4o", "Compilation %": 98.0, "Replication %": 82.5, "Direction %": 75.1},
27
- {"Model": "Claude 3.5 Sonnet", "Compilation %": 96.2, "Replication %": 80.4, "Direction %": 72.8},
28
- ])
29
-
30
- # 计算平均分作为排序依据
31
- df["Overall Score"] = df[["Compilation %", "Replication %", "Direction %"]].mean(axis=1).round(2)
32
- return df.sort_values("Overall Score", ascending=False)
33
-
34
- # --- 3. 界面构建 ---
35
- with gr.Blocks(css=CSS, title="Infernet Leaderboard") as demo:
36
- gr.HTML("<h1 style='text-align: center;'>🏆 Infernet Econometrics Leaderboard</h1>")
37
- gr.HTML("<p style='text-align: center; color: #666;'>CamoAiLab | Evaluating AI Agents in Empirical Social Science Research</p>")
38
-
39
- # 顶部统计卡片
40
- with gr.Row():
41
- df_init = load_data()
42
- gr.HTML(f"<div class='stat-card'><div class='stat-val'>{len(df_init)}</div><div>Total Models</div></div>")
43
- gr.HTML(f"<div class='stat-card'><div class='stat-val'>{df_init['Overall Score'].max()}%</div><div>Best Overall</div></div>")
44
- gr.HTML(f"<div class='stat-card'><div class='stat-val'>1,000</div><div>Test Tasks</div></div>")
45
-
46
- gr.Markdown("---")
47
-
48
- with gr.Tabs():
49
- # 标签页 1:排行榜
50
- with gr.TabItem("📊 Leaderboard"):
51
- search = gr.Textbox(placeholder="🔍 Search for a model...", label=None, show_label=False)
52
- table = gr.Dataframe(value=df_init, interactive=False)
53
-
54
- def filter_table(query):
55
- full_df = load_data()
56
- return full_df[full_df["Model"].str.contains(query, case=False)] if query else full_df
57
-
58
- search.change(fn=filter_table, inputs=search, outputs=table)
59
-
60
- # 标签页 2:指标定义
61
- with gr.TabItem("📖 Metric Definitions"):
62
- gr.Markdown("""
63
- ### 🔍 核心评测指标定义
64
- 1. **Compilation % (编译成功率)**: 生成的代码是否能直接运行通过。
65
- 2. **Replication % (部分复现率)**: 回归系数等统计量与原始论文的重合度。
66
- 3. **Direction % (系数方向正确率)**: **核心指标**。回归系数的正负号是否预测正确。
67
- """)
68
-
69
- # 标签页 3:参与方式
70
- with gr.TabItem("✉️ Submission"):
71
- gr.Markdown("请将您的预测文件上传至 [CamoAiLab/Infernet](https://huggingface.co/datasets/CamoAiLab/Infernet ) 的 Community 讨论区。")
72
-
73
- demo.launch()