ICBCBench-Leaderboard / create_leaderboard.py
Leonnel1220's picture
Upload create_leaderboard.py with huggingface_hub
4ea4e6e verified
Raw
History Blame Contribute Delete
6.5 kB
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Gradio UI – ICBCBench Leaderboard
Dual-track (Objective / Subjective) leaderboard for financial deep research.
"""
from __future__ import annotations
from pathlib import Path
from datetime import datetime
import pandas as pd
import gradio as gr
# ---- Tab components ----
from tabs.leaderboard_tab import create_leaderboard_tab
# from tabs.data_viewer_tab import create_data_viewer_tab
# from tabs.data_viewer_side_by_side_tab import create_data_viewer_side_by_side_tab
def get_leaderboard_info():
leaderboard_path = Path(__file__).parent / "data" / "leaderboard.csv"
if leaderboard_path.exists():
try:
df = pd.read_csv(leaderboard_path)
model_count = len(df)
mtime = leaderboard_path.stat().st_mtime
last_update = datetime.fromtimestamp(mtime).strftime("%d %B %Y")
return model_count, last_update
except Exception:
pass
return 0, "Not yet updated"
model_count, last_update = get_leaderboard_info()
# ---------------------------------------------------------------------------
# UI
# ---------------------------------------------------------------------------
with gr.Blocks(title="ICBCBench Leaderboard") as demo:
# ========= Global CSS =========
gr.HTML("""
<style>
.title-block{
background: linear-gradient(to right, #C41E3A, #8B0000);
background: -webkit-linear-gradient(to right, #C41E3A, #8B0000);
background: -moz-linear-gradient(to right, #C41E3A, #8B0000);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
color: transparent;
text-align: center;
font-size: 2rem;
font-weight: 700;
margin: 0 0 1rem 0;
padding-bottom: 0.2rem;
display: inline-block;
width: 100%;
}
.intro-block{
text-align:center;
margin-bottom:1.25rem;
line-height:2;
}
.intro-block a{
color:#0a58ca;
text-decoration:none;
margin:0 .3rem;
}
.intro-block a:hover{ text-decoration:underline; }
</style>
""")
# ========= Header =========
gr.HTML(f"""
<div class="title-block">
ICBCBench: An Industry Consortium Benchmark for Financial Deep Research
</div>
<div class="intro-block">
ICBCBench evaluates Deep Research Agents on financial tasks through a dual-track paradigm:<br>
<strong>Objective</strong> (verifiable answers) and <strong>Subjective</strong> (expert-aligned report quality).<br>
<a href="https://huggingface.co/spaces/DeepFin-Intelligence/ICBCBench-Leaderboard" target="_blank">HF Space</a> |
<a href="https://arxiv.org/abs/2606.17458" target="_blank">Paper</a> |
<a href="https://github.com/ICBCBench/ICBCBench" target="_blank">Code</a> |
<a href="https://huggingface.co/datasets/DeepFin-Intelligence/ICBCBench" target="_blank">Dataset</a> |
Total models: {model_count} | Last Update: {last_update}<br>
<small style="color: #666; font-size: 0.9em;">
Objective judge: GPT-5.4 &nbsp;|&nbsp; Subjective judge: Gemini-3.1-Pro-Preview
</small>
</div>
""")
# ========= Main Tabs =========
with gr.Tabs():
create_leaderboard_tab() # 🏆 Leaderboard
# sbs_on_load, sbs_outputs = create_data_viewer_side_by_side_tab() # ⚔️ Side-by-Side
# dv_on_load, dv_outputs = create_data_viewer_tab() # 🔍 Data Viewer
# demo.load(fn=dv_on_load, outputs=dv_outputs)
# demo.load(fn=sbs_on_load, outputs=sbs_outputs)
# ========= Citation =========
gr.HTML("""
<style>
.citation-block {
margin-top: 2rem;
padding: 1.5rem;
border: 1px solid #e0e0e0;
border-radius: 8px;
background-color: #f9f9f9;
}
.citation-title {
font-size: 1.25rem;
font-weight: 600;
margin-bottom: 1rem;
color: #333;
}
.citation-content {
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
padding: 1rem;
font-family: monospace;
font-size: 0.9rem;
white-space: pre-wrap;
line-height: 1.5;
position: relative;
}
.copy-btn {
position: absolute;
top: 8px;
right: 8px;
padding: 6px 12px;
background-color: #0a58ca;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 0.85rem;
transition: background-color 0.2s;
}
.copy-btn:hover {
background-color: #084298;
}
.copy-btn.copied {
background-color: #198754;
}
</style>
<div class="citation-block">
<div class="citation-title">📚 Citation</div>
<div class="citation-content" id="citation-text">
<button class="copy-btn" onclick="copyCitation()">Copy</button>
@article{li2026icbcbench,
author = {Weiya Li and Zhiwei Tang and Yizhou He and Chenghao Wang and Liang Feng and Xiao Sun and Dongrui Liu and Zichen Wen and Hu Wei and Jinghang Wang and Yi Luo and Li Guo and Linfeng Zhang},
title = {ICBCBench: An Industry Consortium Benchmark for Financial Deep Research},
journal = {arXiv preprint arXiv:2606.17458},
year = {2026},
}</div>
</div>
<script>
function copyCitation() {
const citationText = `@article{li2026icbcbench,
author = {Weiya Li and Zhiwei Tang and Yizhou He and Chenghao Wang and Liang Feng and Xiao Sun and Dongrui Liu and Zichen Wen and Hu Wei and Jinghang Wang and Yi Luo and Li Guo and Linfeng Zhang},
title = {ICBCBench: An Industry Consortium Benchmark for Financial Deep Research},
journal = {arXiv preprint arXiv:2606.17458},
year = {2026},
}`;
navigator.clipboard.writeText(citationText).then(function() {
const btn = document.querySelector('.copy-btn');
btn.textContent = 'Copied!';
btn.classList.add('copied');
setTimeout(function() {
btn.textContent = 'Copy';
btn.classList.remove('copied');
}, 2000);
});
}
</script>
""")
# ---------------------------------------------------------------------------
# Entrypoint
# ---------------------------------------------------------------------------
if __name__ == "__main__":
demo.launch()