Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Updates.
Browse files- app.py +67 -2
- src/about.py +113 -251
- src/display/css_html_js.py +23 -27
app.py
CHANGED
@@ -6,7 +6,13 @@ from apscheduler.schedulers.background import BackgroundScheduler
|
|
6 |
from gradio_leaderboard import Leaderboard, SelectColumns
|
7 |
from huggingface_hub import whoami
|
8 |
|
9 |
-
from src.about import
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
from src.datamodel.data import F1Data
|
11 |
from src.display.css_html_js import custom_css
|
12 |
from src.display.formatting import styled_error
|
@@ -184,6 +190,16 @@ def get_theme():
|
|
184 |
return "light"
|
185 |
|
186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
blocks = gr.Blocks(
|
188 |
css=custom_css,
|
189 |
theme=get_theme(),
|
@@ -193,7 +209,56 @@ with blocks:
|
|
193 |
|
194 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
195 |
with gr.TabItem("What is FormulaOne", id=0):
|
196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
|
198 |
# (5) Rename tab to "Leaderboard"
|
199 |
with gr.TabItem("Leaderboard", elem_id="formulaone-leaderboard-tab-table", id=1):
|
|
|
6 |
from gradio_leaderboard import Leaderboard, SelectColumns
|
7 |
from huggingface_hub import whoami
|
8 |
|
9 |
+
from src.about import (
|
10 |
+
CITATION_BUTTON_LABEL,
|
11 |
+
CITATION_BUTTON_TEXT,
|
12 |
+
EVALUATION_QUEUE_TEXT,
|
13 |
+
WHAT_IS_F1_HTML_BOTTOM,
|
14 |
+
WHAT_IS_F1_HTML_TOP,
|
15 |
+
)
|
16 |
from src.datamodel.data import F1Data
|
17 |
from src.display.css_html_js import custom_css
|
18 |
from src.display.formatting import styled_error
|
|
|
190 |
return "light"
|
191 |
|
192 |
|
193 |
+
# --- Gradio-based tabs for examples (no JS in HTML) ---
|
194 |
+
def _select_example_tab(choice: str):
|
195 |
+
return (
|
196 |
+
gr.update(visible=(choice == "Warmup")),
|
197 |
+
gr.update(visible=(choice == "Tier 1")),
|
198 |
+
gr.update(visible=(choice == "Tier 2")),
|
199 |
+
)
|
200 |
+
|
201 |
+
|
202 |
+
# Force light theme even if HF user prefers dark
|
203 |
blocks = gr.Blocks(
|
204 |
css=custom_css,
|
205 |
theme=get_theme(),
|
|
|
209 |
|
210 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
211 |
with gr.TabItem("What is FormulaOne", id=0):
|
212 |
+
# Top content up to (but not including) the Examples and the 'latter category' paragraph
|
213 |
+
gr.HTML(WHAT_IS_F1_HTML_TOP)
|
214 |
+
|
215 |
+
# Examples of FormulaOne problems (LaTeX via Markdown; bottom 'tabs' via Radio)
|
216 |
+
with gr.Group(elem_id="f1-examples"):
|
217 |
+
gr.HTML(
|
218 |
+
'<div class="f1-tabs-body"><h3 class="f1-examples-title">Examples of FormulaOne problems</h3></div>'
|
219 |
+
)
|
220 |
+
|
221 |
+
_latex = [
|
222 |
+
{"left": "$$", "right": "$$", "display": True},
|
223 |
+
{"left": "$", "right": "$", "display": False},
|
224 |
+
{"left": "\\(", "right": "\\)", "display": False},
|
225 |
+
{"left": "\\[", "right": "\\]", "display": True},
|
226 |
+
]
|
227 |
+
|
228 |
+
md_warmup = gr.Markdown(
|
229 |
+
value=(
|
230 |
+
'<p class="f1-problem-name"><code>Union-of-Paths-and-Cycles</code></p>\n'
|
231 |
+
"Given a tree-like graph $G=(V,E)$ and a weight function $w:V\\to\\mathbb{N}$, compute the sum of all weights of sets $S\\subseteq V$ such that the induced subgraph $G[S]$ is a disjoint union of paths and cycles."
|
232 |
+
),
|
233 |
+
latex_delimiters=_latex,
|
234 |
+
)
|
235 |
+
md_tier1 = gr.Markdown(
|
236 |
+
value=(
|
237 |
+
'<p class="f1-problem-name"><code>Maximal-Union-of-Paths-and-Cycles</code></p>\n'
|
238 |
+
"Given a tree-like graph $G=(V,E)$ and a weight function $w:V\\to\\mathbb{N}$, compute the sum of all weights of sets $S\\subseteq V$ such that $G[S]$ is a disjoint union of paths and cycles and $S$ is maximal with respect to this property."
|
239 |
+
),
|
240 |
+
visible=False,
|
241 |
+
latex_delimiters=_latex,
|
242 |
+
)
|
243 |
+
md_tier2 = gr.Markdown(
|
244 |
+
value=(
|
245 |
+
'<p class="f1-problem-name"><code>Maximal-Union-of-Cycles</code></p>\n'
|
246 |
+
"Given a tree-like graph $G=(V,E)$ and a weight function $w:V\\to\\mathbb{N}$, compute the sum of all weights of sets $S\\subseteq V$ such that $G[S]$ is a disjoint union of cycles and $S$ is maximal with respect to this property."
|
247 |
+
),
|
248 |
+
visible=False,
|
249 |
+
latex_delimiters=_latex,
|
250 |
+
)
|
251 |
+
|
252 |
+
tab_radio = gr.Radio(
|
253 |
+
choices=["Warmup", "Tier 1", "Tier 2"],
|
254 |
+
value="Warmup",
|
255 |
+
label=None,
|
256 |
+
elem_id="f1-example-radio",
|
257 |
+
)
|
258 |
+
tab_radio.change(_select_example_tab, inputs=tab_radio, outputs=[md_warmup, md_tier1, md_tier2])
|
259 |
+
|
260 |
+
# Bottom content: the 'latter category' paragraph and all following sections
|
261 |
+
gr.HTML(WHAT_IS_F1_HTML_BOTTOM)
|
262 |
|
263 |
# (5) Rename tab to "Leaderboard"
|
264 |
with gr.TabItem("Leaderboard", elem_id="formulaone-leaderboard-tab-table", id=1):
|
src/about.py
CHANGED
@@ -1,256 +1,118 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
<header class="text-center mb-12">
|
10 |
-
<h1 class="text-4xl md:text-5xl font-bold text-gray-900 f1-h1">FormulaOne</h1>
|
11 |
-
</header>
|
12 |
-
|
13 |
-
<section>
|
14 |
-
<p class="text-lg mb-4 f1-p">Frontier AI models have recently demonstrated strong performance on mathematical and algorithmic benchmarks, including earning <a href="https://deepmind.google/discover/blog/advanced-version-of-gemini-with-deep-think-officially-achieves-gold-medal-standard-at-the-international-mathematical-olympiad/" target="_blank" rel="noopener noreferrer" class="f1-a">gold medals in olympiads</a>, and attaining <a href="https://arxiv.org/html/2502.06807v1" target="_blank" rel="noopener noreferrer" class="f1-a">top percentile ratings</a> in competitive programming contests. How well do such benchmarks capture the true depth of algorithmic reasoning, as it arises in real-world research problems?</p>
|
15 |
-
|
16 |
-
<p class="text-lg mb-4 f1-p">We believe that existing benchmarks fail to capture the deep reasoning skills required for complex, research-level algorithmic problems. To address this gap, <a href="{PAPER_URL}" target="_blank" rel="noopener noreferrer" class="f1-a">we introduce <strong>FormulaOne</strong></a>.</p>
|
17 |
-
|
18 |
-
<p class="mb-4 f1-p"><strong>FormulaOne</strong> consists of 220 novel dynamic programming problems over graphs. The problems are organised into three categories, ranging from moderate difficulty and all the way up to research-level.</p>
|
19 |
-
|
20 |
-
<!-- Clean, centered table -->
|
21 |
-
<div class="f1-table-wrap">
|
22 |
-
<table class="f1-table" aria-label="FormulaOne categories">
|
23 |
-
<thead>
|
24 |
-
<tr>
|
25 |
-
<th>Category</th>
|
26 |
-
<th>Size</th>
|
27 |
-
<th>Description</th>
|
28 |
-
</tr>
|
29 |
-
</thead>
|
30 |
-
<tbody>
|
31 |
-
<tr>
|
32 |
-
<td>Warmup</td>
|
33 |
-
<td>100</td>
|
34 |
-
<td>A set of “easier” problems.</td>
|
35 |
-
</tr>
|
36 |
-
<tr>
|
37 |
-
<td>Tier 1</td>
|
38 |
-
<td>100</td>
|
39 |
-
<td>A set of challenging problems.</td>
|
40 |
-
</tr>
|
41 |
-
<tr>
|
42 |
-
<td>Tier 2</td>
|
43 |
-
<td>20</td>
|
44 |
-
<td>A set of highly challenging problems.</td>
|
45 |
-
</tr>
|
46 |
-
</tbody>
|
47 |
-
</table>
|
48 |
-
</div>
|
49 |
-
|
50 |
-
<!-- Compact bottom tabs -->
|
51 |
-
<div class="mt-6 f1-tabs" id="f1-examples">
|
52 |
-
<div class="f1-tabs-body">
|
53 |
-
<h3 class="text-xl font-semibold mb-2" style="color:#111827;">Examples of FormulaOne problems</h3>
|
54 |
-
|
55 |
-
<div class="problem-panel" id="panel-warmup">
|
56 |
-
<div class="f1-problem-box">
|
57 |
-
<p class="f1-problem-name">Union-of-Paths-and-Cycles</p>
|
58 |
-
<p class="mb-2 f1-p">Given a tree-like graph $G=(V,E)$, compute the sum of all weights of sets $S\\subseteq V$ such that the induced subgraph $G[S]$ is a disjoint union of paths and cycles.</p>
|
59 |
-
</div>
|
60 |
-
</div>
|
61 |
-
|
62 |
-
<div class="problem-panel" id="panel-tier1" style="display:none;">
|
63 |
-
<div class="f1-problem-box">
|
64 |
-
<p class="f1-problem-name">Maximal-Union-of-Paths-and-Cycles</p>
|
65 |
-
<p class="mb-2 f1-p">Given a tree-like graph $G=(V,E)$, compute the sum of all weights of sets $S\\subseteq V$ such that $G[S]$ is a disjoint union of paths and cycles and $S$ is maximal with respect to this property.</p>
|
66 |
-
</div>
|
67 |
-
</div>
|
68 |
-
|
69 |
-
<div class="problem-panel" id="panel-tier2" style="display:none;">
|
70 |
-
<div class="f1-problem-box">
|
71 |
-
<p class="f1-problem-name">Maximal-Union-of-Cycles</p>
|
72 |
-
<p class="mb-2 f1-p">Given a tree-like graph $G=(V,E)$, compute the sum of all weights of sets $S\\subseteq V$ such that $G[S]$ is a disjoint union of cycles and $S$ is maximal with respect to this property.</p>
|
73 |
-
</div>
|
74 |
-
</div>
|
75 |
-
</div>
|
76 |
-
|
77 |
-
<div class="f1-tabs-buttons" role="tablist" aria-label="Example tiers">
|
78 |
-
<button class="f1-tab-btn" id="tab-warmup" role="tab" aria-controls="panel-warmup" aria-selected="true">Warmup</button>
|
79 |
-
<button class="f1-tab-btn" id="tab-tier1" role="tab" aria-controls="panel-tier1" aria-selected="false">Tier 1</button>
|
80 |
-
<button class="f1-tab-btn" id="tab-tier2" role="tab" aria-controls="panel-tier2" aria-selected="false">Tier 2</button>
|
81 |
-
</div>
|
82 |
-
</div>
|
83 |
-
|
84 |
-
<p class="mb-4 f1-p">The latter category is incredibly demanding, requiring resolution of many points of uncertainty, and involving an array of reasoning steps, including topological and geometric insight, knowledge of mathematical domains such as extremal graph theory and logic, combinatorial considerations, precise implementation, and more.</p>
|
85 |
-
|
86 |
-
<p class="f1-p">Despite <a href="https://epoch.ai/frontiermath" target="_blank" rel="noopener noreferrer" class="f1-a">impressive</a> <a href="https://artificialanalysis.ai/evaluations/gpqa-diamond" target="_blank" rel="noopener noreferrer" class="f1-a">performance</a> on existing benchmarks, presently <strong>no model solves even a single FormulaOne Tier 2 problem</strong>.<sup><a href="#evaluation" class="f1-a">1</a></sup></p>
|
87 |
-
</section>
|
88 |
-
|
89 |
-
<section>
|
90 |
-
<h2 class="text-3xl font-bold text-gray-900 f1-h2">An “Infinite Well” of Problems</h2>
|
91 |
-
|
92 |
-
<div class="f1-problem-box">
|
93 |
-
<p class="mb-2 f1-p"><strong>Input:</strong> A tree-like graph $G=(V,E)$, a tree decomposition $\\mathcal{{T}}$ of $G$, and a weight function $w: V \\to \\mathbb{{N}}$.</p>
|
94 |
-
<p class="mb-2 f1-p"><strong>Goal:</strong> Compute the sum of all weights of sets $S \\subseteq V$ such that the induced subgraph $G[S]$ contains no cycle of length four.</p>
|
95 |
-
<p class="text-sm f1-p" style="color:#6b7280;"><strong>Notation:</strong> The weight of a set $S$ is defined as $w(S) \\triangleq \\sum_{{v\\in S}} w(v)$. Return the final result modulo $10^9+7$.</p>
|
96 |
-
</div>
|
97 |
-
|
98 |
-
<p class="mb-4 f1-p">While the problems are often natural to state, their solutions are far from obvious. The solvability of this vast class of problems is guaranteed by an algorithmic <strong>meta-theorem</strong> due to <a href="https://en.wikipedia.org/wiki/Courcelle%27s_theorem" target="_blank" rel="noopener noreferrer" class="f1-a">Courcelle</a>, which broadly states:</p>
|
99 |
-
|
100 |
-
<blockquote class="my-6 f1-blockquote">
|
101 |
-
“For every sufficiently tree-like graph, any problem definable in an expressive formal logic — Monadic Second-Order (MSO) logic — can be solved by a dynamic programming algorithm that operates in time linear in the order of the graph.”
|
102 |
-
</blockquote>
|
103 |
-
|
104 |
-
<p class="f1-p">The key is to use a structure known as a tree decomposition, which organises the graph’s vertices into a series of overlapping sets, or “bags”, that are themselves arranged in a tree.</p>
|
105 |
-
|
106 |
-
<figure class="f1-figure">
|
107 |
-
<img src="/file=assets/bag_modifications.png" alt="An illustration of local modifications to bags (dashed boxes)" class="max-w-full md:max-w-2xl mx-auto rounded-lg shadow-md">
|
108 |
-
<figcaption class="f1-figcaption">An illustration of local modifications to bags: Introduce, Forget, and Join.</figcaption>
|
109 |
-
</figure>
|
110 |
-
|
111 |
-
<p class="mb-4 f1-p">An algorithm can then traverse this tree of bags, solving the problem piece by piece using dynamic programming. This process involves designing a “state” that summarises all necessary information about the partial solution within a bag, and then defining how this state transforms as vertices are introduced, forgotten, or bags are merged.</p>
|
112 |
-
|
113 |
-
<figure class="f1-figure">
|
114 |
-
<video class="w-full max-w-2xl mx-auto rounded-lg shadow-lg" autoplay loop muted playsinline>
|
115 |
-
<source src="/file=assets/dp_animation.mp4" type="video/mp4">
|
116 |
-
Your browser does not support the video tag.
|
117 |
-
</video>
|
118 |
-
<figcaption class="f1-figcaption">Animation showing the design of a compressed dynamic programming state-space.</figcaption>
|
119 |
-
</figure>
|
120 |
-
|
121 |
-
<p class="f1-p">The deceptive simplicity of the problem statements belies the <strong>extraordinary difficulty</strong> of discovering the correct dynamic programming solution. This process is riddled with subtle combinatorial and logical pitfalls, demanding a profound understanding of the problem’s underlying structure. For a detailed walkthrough of the fifteen interdependent reasoning steps required to solve a single hard problem – <strong>Maximal-Cluster-Graph</strong> – <a href="https://arxiv.org/pdf/2507.13337#appendix.A" target="_blank" rel="noopener noreferrer" class="f1-a">see the appendix of our paper</a>.</p>
|
122 |
-
</section>
|
123 |
-
|
124 |
-
<section id="evaluation">
|
125 |
-
<h2 class="text-3xl font-bold text-gray-900 f1-h2">Evaluation</h2>
|
126 |
-
|
127 |
-
<p class="mb-4 f1-p">To give models the best possible chance of success, we provide a generous few-shot prompt that covers a broad array of the ideas and techniques involved in solving these problems. All models were evaluated using their highest available reasoning settings and with the maximum context length permitted.</p>
|
128 |
-
|
129 |
-
<p class="mb-4 f1-p">Each submitted solution is subjected to a rigorous and automated <a href="https://arxiv.org/pdf/2507.13337#section.4" target="_blank" rel="noopener noreferrer" class="f1-a">test suite</a> that measures three key aspects of its validity:</p>
|
130 |
-
<ul class="list-disc list-inside space-y-2 mb-6">
|
131 |
-
<li class="f1-li"><strong>Correctness:</strong> The output of the submitted algorithm must be correct on all graphs.</li>
|
132 |
-
<li class="f1-li"><strong>Consistency:</strong> The solution must produce the same output for a given graph, regardless of the specific structure of its tree decomposition.</li>
|
133 |
-
<li class="f1-li"><strong>Efficiency:</strong> The solution must be truly <a href="https://en.wikipedia.org/wiki/Parameterized_complexity" target="_blank" rel="noopener noreferrer" class="f1-a">fixed-parameter linear</a>.</li>
|
134 |
-
</ul>
|
135 |
-
|
136 |
-
<p class="mb-4 f1-p">To support research and encourage community contributions, the <code>FormulaOne-Warmup</code> dataset is released as a public resource for training and fine-tuning models. The complete test suite for all 100 Warmup problems is available, alongside a standalone evaluation environment, in our <a href="https://github.com/double-ai/formulaone-dataset/tree/main" target="_blank" rel="noopener noreferrer" class="f1-a">GitHub repository</a>.</p>
|
137 |
-
|
138 |
-
<p class="f1-p">To maintain the integrity of the core benchmark, only a minimal subset of tests is released for the Tier 1 and Tier 2 problems.</p>
|
139 |
-
|
140 |
-
<h3 class="text-2xl font-bold text-gray-900 mt-8 mb-4">Model Accuracy</h3>
|
141 |
-
|
142 |
-
<p class="mb-4 f1-p">On the <strong>FormulaOne-Warmup</strong> problems, frontier models perform reasonably well. This confirms they have a foundational capability for these types of algorithmic tasks.</p>
|
143 |
-
|
144 |
-
<figure class="f1-figure">
|
145 |
-
<img src="/file=assets/warmup_performance.png" alt="Plot showing model performance on FormulaOne-Warmup" class="max-w-full md:max-w-2xl mx-auto rounded-lg shadow-md">
|
146 |
-
<figcaption class="f1-figcaption">Performance of frontier models on the FormulaOne-Warmup dataset.</figcaption>
|
147 |
-
</figure>
|
148 |
-
|
149 |
-
<p class="mb-4 f1-p">However, as the reasoning depth increases in <strong>Tier 1</strong>, and solutions require the discovery and integration of novel and more complex state representations, model performance drops off sharply.</p>
|
150 |
-
|
151 |
-
<figure class="f1-figure">
|
152 |
-
<img src="/file=assets/tier1_performance.png" alt="Plot showing model performance on FormulaOne Tier 1" class="max-w-full md:max-w-2xl mx-auto rounded-lg shadow-md">
|
153 |
-
<figcaption class="f1-figcaption">Figure 1: Performance of frontier reasoning models on the FormulaOne dataset.</figcaption>
|
154 |
-
</figure>
|
155 |
-
|
156 |
-
<p class="f1-p">This trend culminates in <strong>Tier 2</strong>, where the difficulty is characteristic of exploratory research problems. On this set of 20 problems, no current frontier model solves even a single one. This result starkly illustrates the gap that remains between high performance on existing benchmarks and the deep algorithmic reasoning required for truly complex problems.</p>
|
157 |
-
</section>
|
158 |
-
</main>
|
159 |
-
|
160 |
-
<!-- MathJax config FIRST (escaped {{ }}) -->
|
161 |
-
<script>
|
162 |
-
window.MathJax = {{
|
163 |
-
tex: {{ inlineMath: [['$', '$'], ['\\\\(', '\\\\)']] }},
|
164 |
-
options: {{ skipHtmlTags: ['script','noscript','style','textarea','pre','code'] }}
|
165 |
-
}};
|
166 |
-
</script>
|
167 |
-
<!-- Then load MathJax -->
|
168 |
-
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
169 |
-
|
170 |
-
<!-- Tabs JS: works + re-typesets -->
|
171 |
-
<script>
|
172 |
-
setTimeout(() => {{
|
173 |
-
const tabs = [
|
174 |
-
{{ button: document.getElementById('tab-warmup'), panel: document.getElementById('panel-warmup') }},
|
175 |
-
{{ button: document.getElementById('tab-tier1'), panel: document.getElementById('panel-tier1') }},
|
176 |
-
{{ button: document.getElementById('tab-tier2'), panel: document.getElementById('panel-tier2') }}
|
177 |
-
];
|
178 |
-
|
179 |
-
function selectTab(idx) {{
|
180 |
-
tabs.forEach((t, i) => {{
|
181 |
-
const sel = (i === idx);
|
182 |
-
if (!t.button || !t.panel) return;
|
183 |
-
t.button.setAttribute('aria-selected', sel ? 'true' : 'false');
|
184 |
-
t.panel.style.display = sel ? '' : 'none';
|
185 |
-
}});
|
186 |
-
if (window.MathJax && window.MathJax.typesetPromise) {{
|
187 |
-
window.MathJax.typesetPromise();
|
188 |
-
}}
|
189 |
-
}}
|
190 |
-
|
191 |
-
tabs.forEach((t, i) => {{
|
192 |
-
if (t.button) t.button.addEventListener('click', () => selectTab(i));
|
193 |
-
}});
|
194 |
-
|
195 |
-
selectTab(0);
|
196 |
-
}}, 120);
|
197 |
-
</script>
|
198 |
-
</body>
|
199 |
-
</html>
|
200 |
-
"""
|
201 |
-
|
202 |
-
EVALUATION_QUEUE_TEXT = """
|
203 |
-
## Submitting to the FormulaOne Leaderboard
|
204 |
-
|
205 |
-
This leaderboard evaluates systems on the FormulaOne core dataset. Submissions consist of a .jsonl file with solution code for each problem.
|
206 |
-
|
207 |
-
### 📁 I. Format Your Submission File
|
208 |
-
|
209 |
-
Your submission must be a .jsonl file with one entry per problem:
|
210 |
-
|
211 |
-
```json
|
212 |
-
{"problem_id": "1", "solution": "<your Python code here>"}
|
213 |
-
{"problem_id": "2", "solution": "<your Python code here>"}
|
214 |
-
...
|
215 |
-
```
|
216 |
-
|
217 |
-
- problem_id: Must match the official list of FormulaOne core problems.
|
218 |
-
- solution: A Python code implementing the required callback functions.
|
219 |
-
|
220 |
-
📄 Full list of problem_ids:
|
221 |
-
View the [FormulaOne core dataset](https://github.com/double-ai/formulaone-dataset-release/dataset/formulaone) for the complete list of problem IDs.
|
222 |
-
|
223 |
-
⚠️ Validation Rules:
|
224 |
-
Submissions must:
|
225 |
-
- Contain exactly two columns: ["problem_id", "solution"]
|
226 |
-
- Include all required problems (no missing/unknown IDs)
|
227 |
-
- Provide solutions as Python strings
|
228 |
-
- Avoid duplicates
|
229 |
-
|
230 |
-
### 📤 II. Submit via the UI below
|
231 |
-
|
232 |
-
- Upload your `.jsonl` file.
|
233 |
-
- Fill in the following fields:
|
234 |
-
- **System Name**
|
235 |
-
- **Organization**
|
236 |
-
- **System Type**
|
237 |
-
- Click **Submit**.
|
238 |
-
|
239 |
-
### ⏱️ After Submission
|
240 |
|
241 |
-
|
242 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
custom_css = """
|
2 |
+
:root, [data-theme="light"] {
|
3 |
+
--f1-text: #111827;
|
4 |
+
--f1-subtle: #6b7280;
|
5 |
+
--f1-border: #e5e7eb;
|
6 |
+
--f1-bg: #ffffff;
|
7 |
+
--f1-bg-muted: #f9fafb;
|
8 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
+
/* Readable width */
|
11 |
+
.f1-container { max-width: 800px; margin: 0 auto; padding: 0 16px; }
|
12 |
+
.markdown-text { font-size: 16px !important; max-width: 800px; margin: 0 auto; }
|
13 |
+
|
14 |
+
/* Paragraphs: nice wrapping */
|
15 |
+
.f1-p, .f1-li {
|
16 |
+
line-height: 1.75;
|
17 |
+
color: #374151;
|
18 |
+
text-align: left;
|
19 |
+
text-wrap: pretty;
|
20 |
+
overflow-wrap: break-word;
|
21 |
+
hyphens: auto;
|
22 |
+
word-break: normal;
|
23 |
+
}
|
24 |
|
25 |
+
/* Headings */
|
26 |
+
.f1-h1 { font-weight: 700; font-size: 2.25rem; line-height: 2.5rem; color: var(--f1-text); text-align: center; margin-bottom: 1.25rem !important; }
|
27 |
+
.f1-h2 { /* smaller section headings */
|
28 |
+
font-weight: 700;
|
29 |
+
border-bottom: 1px solid var(--f1-border);
|
30 |
+
padding-bottom: 0.45rem;
|
31 |
+
margin-top: 1.75rem;
|
32 |
+
margin-bottom: 0.9rem;
|
33 |
+
color: var(--f1-text);
|
34 |
+
font-size: 1.5rem;
|
35 |
+
line-height: 2rem;
|
36 |
+
}
|
37 |
|
38 |
+
/* Links */
|
39 |
+
.f1-a { color: #2563eb; text-decoration: none; font-weight: 500; }
|
40 |
+
.f1-a:hover { text-decoration: underline; }
|
41 |
+
|
42 |
+
/* Blockquote & problem box */
|
43 |
+
.f1-blockquote { border-left: 4px solid #d1d5db; padding-left: 1rem; margin-left: 0; font-style: italic; color: #4b5563; }
|
44 |
+
.f1-problem-box { background-color: var(--f1-bg-muted); border: 1px solid var(--f1-border); border-radius: 8px; padding: 16px; margin-top: 16px; margin-bottom: 16px; box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04); }
|
45 |
+
.f1-problem-name { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-weight: 600; text-align: center; }
|
46 |
+
|
47 |
+
/* Clean, centered table: only top & left borders; not full width; headers centered */
|
48 |
+
.f1-table-wrap { margin: 10px auto 8px auto; text-align: center; }
|
49 |
+
.f1-table {
|
50 |
+
border-collapse: collapse;
|
51 |
+
width: auto; /* not full width */
|
52 |
+
margin: 0 auto; /* centered */
|
53 |
+
border-top: 1px solid var(--f1-border);
|
54 |
+
border-left: 1px solid var(--f1-border);
|
55 |
+
background: var(--f1-bg);
|
56 |
}
|
57 |
+
.f1-table th, .f1-table td {
|
58 |
+
padding: 8px 12px;
|
59 |
+
text-align: left;
|
60 |
+
vertical-align: top;
|
61 |
+
}
|
62 |
+
.f1-table th { text-align: center; } /* header cells centered */
|
63 |
+
.f1-table tr + tr td { border-top: 1px solid var(--f1-border); } /* row separators that visually keep top line only */
|
64 |
+
.f1-table td + td, .f1-table th + th { border-left: 1px solid var(--f1-border); } /* vertical grid from left border only */
|
65 |
+
|
66 |
+
/* Examples block (Gradio-based) */
|
67 |
+
#f1-examples { border: 1px solid var(--f1-border); border-radius: 8px; background: var(--f1-bg); margin-bottom: 12px; }
|
68 |
+
#f1-examples .f1-examples-title { font-weight: 700; margin: 12px 14px 4px 14px; color: var(--f1-text); font-size: 1.1rem; }
|
69 |
+
#f1-example-radio { border-top: 1px solid var(--f1-border); padding: 6px 8px; }
|
70 |
+
#f1-example-radio .wrap { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-start; }
|
71 |
+
#f1-example-radio label { border: 1px solid transparent; border-radius: 6px; padding: 6px 10px; cursor: pointer; }
|
72 |
+
#f1-example-radio input[type="radio"]:checked + span { background: var(--f1-bg-muted); border: 1px solid var(--f1-border); border-radius: 6px; padding: 6px 10px; }
|
73 |
+
|
74 |
+
/* Leaderboard: full-width controls, nesting rule, center container */
|
75 |
+
#formulaone-leaderboard-tab-table { max-width: 1200px; margin-left: auto; margin-right: auto; } /* center the whole tab (8) */
|
76 |
+
#formulaone-leaderboard-tab-table .gr-column .gr-row .gr-column { min-width: 80% !important; } /* (7) exact chain rule */
|
77 |
+
#formulaone-leaderboard-tab-table .gr-row, #formulaone-leaderboard-tab-table .gr-column { width: 100% !important; max-width: 100% !important; }
|
78 |
+
#formulaone-leaderboard-tab-table [data-testid="dropdown"], #formulaone-leaderboard-tab-table input[type="text"] { width: 100% !important; }
|
79 |
+
|
80 |
+
/* Login button: force light */
|
81 |
+
#hf-login-btn, #hf-login-btn button, button[data-testid="login-button"], [data-testid="login-button"] button, div[data-testid="login-button"] > button {
|
82 |
+
background: #ffffff !important;
|
83 |
+
color: #1f2937 !important;
|
84 |
+
border: 1px solid var(--f1-border) !important;
|
85 |
+
box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04) !important;
|
86 |
+
}
|
87 |
+
#hf-login-btn:hover, #hf-login-btn button:hover, button[data-testid="login-button"]:hover, [data-testid="login-button"] button:hover, div[data-testid="login-button"] > button:hover { background: #f9fafb !important; }
|
88 |
+
|
89 |
+
/* Misc retained */
|
90 |
+
#models-to-add-text { font-size: 18px !important; }
|
91 |
+
#citation-button span { font-size: 16px !important; }
|
92 |
+
#citation-button textarea { font-size: 16px !important; }
|
93 |
+
#citation-button > label > button { margin: 6px; transform: scale(1.3); }
|
94 |
+
#leaderboard-table { margin-top: 15px }
|
95 |
+
#leaderboard-table-lite { margin-top: 15px }
|
96 |
+
#search-bar-table-box > div:first-child { background: none; border: none; }
|
97 |
+
#search-bar { padding: 0px; }
|
98 |
+
#leaderboard-table td:nth-child(2), #leaderboard-table th:nth-child(2) { max-width: 400px; overflow: auto; white-space: nowrap; }
|
99 |
+
#scale-logo { border-style: none !important; box-shadow: none; display: block; margin-left: auto; margin-right: auto; max-width: 600px; }
|
100 |
+
#scale-logo .download { display: none; }
|
101 |
+
#filter_type{ border: 0; padding-left: 0; padding-top: 0; }
|
102 |
+
#filter_type label { display: flex; }
|
103 |
+
#filter_type label > span{ margin-top: var(--spacing-lg); margin-right: 0.5em; }
|
104 |
+
#filter_type label > .wrap{ width: 103px; }
|
105 |
+
#filter_type label > .wrap .wrap-inner{ padding: 2px; }
|
106 |
+
#filter_type label > .wrap .wrap-inner input{ width: 1px }
|
107 |
+
#filter-columns-type{ border:0; padding:0.5; }
|
108 |
+
#filter-columns-size{ border:0; padding:0.5; }
|
109 |
+
#box-filter > .form{ border: 0 }
|
110 |
"""
|
111 |
+
|
112 |
+
get_window_url_params = """
|
113 |
+
function(url_params) {
|
114 |
+
const params = new URLSearchParams(window.location.search);
|
115 |
+
url_params = Object.fromEntries(params);
|
116 |
+
return url_params;
|
117 |
+
}
|
118 |
+
"""
|
src/display/css_html_js.py
CHANGED
@@ -8,14 +8,14 @@ custom_css = """
|
|
8 |
}
|
9 |
|
10 |
/* Readable width */
|
11 |
-
.f1-container { max-width: 800px; margin: 0 auto; padding: 0 16px; }
|
12 |
.markdown-text { font-size: 16px !important; max-width: 800px; margin: 0 auto; }
|
13 |
|
14 |
/* Paragraphs: nice wrapping */
|
15 |
.f1-p, .f1-li {
|
16 |
line-height: 1.75;
|
17 |
color: #374151;
|
18 |
-
text-align: left;
|
19 |
text-wrap: pretty;
|
20 |
overflow-wrap: break-word;
|
21 |
hyphens: auto;
|
@@ -24,14 +24,14 @@ custom_css = """
|
|
24 |
|
25 |
/* Headings */
|
26 |
.f1-h1 { font-weight: 700; font-size: 2.25rem; line-height: 2.5rem; color: var(--f1-text); text-align: center; margin-bottom: 1.25rem !important; }
|
27 |
-
.f1-h2 { /*
|
28 |
font-weight: 700;
|
29 |
border-bottom: 1px solid var(--f1-border);
|
30 |
padding-bottom: 0.45rem;
|
31 |
margin-top: 1.75rem;
|
32 |
margin-bottom: 0.9rem;
|
33 |
color: var(--f1-text);
|
34 |
-
font-size: 1.5rem;
|
35 |
line-height: 2rem;
|
36 |
}
|
37 |
|
@@ -42,14 +42,14 @@ custom_css = """
|
|
42 |
/* Blockquote & problem box */
|
43 |
.f1-blockquote { border-left: 4px solid #d1d5db; padding-left: 1rem; margin-left: 0; font-style: italic; color: #4b5563; }
|
44 |
.f1-problem-box { background-color: var(--f1-bg-muted); border: 1px solid var(--f1-border); border-radius: 8px; padding: 16px; margin-top: 16px; margin-bottom: 16px; box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04); }
|
45 |
-
.f1-problem-name { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-weight: 600; text-align: center; }
|
46 |
|
47 |
-
/*
|
48 |
.f1-table-wrap { margin: 10px auto 8px auto; text-align: center; }
|
49 |
.f1-table {
|
50 |
border-collapse: collapse;
|
51 |
-
width: auto;
|
52 |
-
margin: 0 auto;
|
53 |
border-top: 1px solid var(--f1-border);
|
54 |
border-left: 1px solid var(--f1-border);
|
55 |
background: var(--f1-bg);
|
@@ -59,26 +59,22 @@ custom_css = """
|
|
59 |
text-align: left;
|
60 |
vertical-align: top;
|
61 |
}
|
62 |
-
.f1-table th {
|
|
|
|
|
63 |
|
64 |
-
/*
|
65 |
-
|
66 |
-
.f1-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
border-radius: 6px;
|
72 |
-
border: 1px solid transparent;
|
73 |
-
background: transparent;
|
74 |
-
color: #374151;
|
75 |
-
cursor: pointer;
|
76 |
-
}
|
77 |
-
.f1-tab-btn[aria-selected="true"] { background: var(--f1-bg-muted); border-color: var(--f1-border); }
|
78 |
|
79 |
-
/* Leaderboard width
|
80 |
-
#formulaone-leaderboard-tab-table
|
81 |
-
#formulaone-leaderboard-tab-table .gr-
|
|
|
82 |
#formulaone-leaderboard-tab-table [data-testid="dropdown"], #formulaone-leaderboard-tab-table input[type="text"] { width: 100% !important; }
|
83 |
|
84 |
/* Login button: force light */
|
@@ -90,7 +86,7 @@ custom_css = """
|
|
90 |
}
|
91 |
#hf-login-btn:hover, #hf-login-btn button:hover, button[data-testid="login-button"]:hover, [data-testid="login-button"] button:hover, div[data-testid="login-button"] > button:hover { background: #f9fafb !important; }
|
92 |
|
93 |
-
/* Misc
|
94 |
#models-to-add-text { font-size: 18px !important; }
|
95 |
#citation-button span { font-size: 16px !important; }
|
96 |
#citation-button textarea { font-size: 16px !important; }
|
|
|
8 |
}
|
9 |
|
10 |
/* Readable width */
|
11 |
+
.f1-container { max-width: 800px; margin: 0 auto; padding: 0 16px; }
|
12 |
.markdown-text { font-size: 16px !important; max-width: 800px; margin: 0 auto; }
|
13 |
|
14 |
/* Paragraphs: nice wrapping */
|
15 |
.f1-p, .f1-li {
|
16 |
line-height: 1.75;
|
17 |
color: #374151;
|
18 |
+
text-align: left;
|
19 |
text-wrap: pretty;
|
20 |
overflow-wrap: break-word;
|
21 |
hyphens: auto;
|
|
|
24 |
|
25 |
/* Headings */
|
26 |
.f1-h1 { font-weight: 700; font-size: 2.25rem; line-height: 2.5rem; color: var(--f1-text); text-align: center; margin-bottom: 1.25rem !important; }
|
27 |
+
.f1-h2 { /* smaller section headings */
|
28 |
font-weight: 700;
|
29 |
border-bottom: 1px solid var(--f1-border);
|
30 |
padding-bottom: 0.45rem;
|
31 |
margin-top: 1.75rem;
|
32 |
margin-bottom: 0.9rem;
|
33 |
color: var(--f1-text);
|
34 |
+
font-size: 1.5rem;
|
35 |
line-height: 2rem;
|
36 |
}
|
37 |
|
|
|
42 |
/* Blockquote & problem box */
|
43 |
.f1-blockquote { border-left: 4px solid #d1d5db; padding-left: 1rem; margin-left: 0; font-style: italic; color: #4b5563; }
|
44 |
.f1-problem-box { background-color: var(--f1-bg-muted); border: 1px solid var(--f1-border); border-radius: 8px; padding: 16px; margin-top: 16px; margin-bottom: 16px; box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04); }
|
45 |
+
.f1-problem-name { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-weight: 600; text-align: center; }
|
46 |
|
47 |
+
/* Clean, centered table: only top & left borders; not full width; headers centered */
|
48 |
.f1-table-wrap { margin: 10px auto 8px auto; text-align: center; }
|
49 |
.f1-table {
|
50 |
border-collapse: collapse;
|
51 |
+
width: auto; /* not full width */
|
52 |
+
margin: 0 auto; /* centered */
|
53 |
border-top: 1px solid var(--f1-border);
|
54 |
border-left: 1px solid var(--f1-border);
|
55 |
background: var(--f1-bg);
|
|
|
59 |
text-align: left;
|
60 |
vertical-align: top;
|
61 |
}
|
62 |
+
.f1-table th { text-align: center; } /* header cells centered */
|
63 |
+
.f1-table tr + tr td { border-top: 1px solid var(--f1-border); } /* row separators that visually keep top line only */
|
64 |
+
.f1-table td + td, .f1-table th + th { border-left: 1px solid var(--f1-border); } /* vertical grid from left border only */
|
65 |
|
66 |
+
/* Examples block (Gradio-based) */
|
67 |
+
#f1-examples { border: 1px solid var(--f1-border); border-radius: 8px; background: var(--f1-bg); margin-bottom: 12px; }
|
68 |
+
#f1-examples .f1-examples-title { font-weight: 700; margin: 12px 14px 4px 14px; color: var(--f1-text); font-size: 1.1rem; }
|
69 |
+
#f1-example-radio { border-top: 1px solid var(--f1-border); padding: 6px 8px; }
|
70 |
+
#f1-example-radio .wrap { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-start; }
|
71 |
+
#f1-example-radio label { border: 1px solid transparent; border-radius: 6px; padding: 6px 10px; cursor: pointer; }
|
72 |
+
#f1-example-radio input[type="radio"]:checked + span { background: var(--f1-bg-muted); border: 1px solid var(--f1-border); border-radius: 6px; padding: 6px 10px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
+
/* Leaderboard: full-width controls, nesting rule, center container */
|
75 |
+
#formulaone-leaderboard-tab-table { max-width: 1200px; margin-left: auto; margin-right: auto; } /* center the whole tab (8) */
|
76 |
+
#formulaone-leaderboard-tab-table .gr-column .gr-row .gr-column { min-width: 80% !important; } /* (7) exact chain rule */
|
77 |
+
#formulaone-leaderboard-tab-table .gr-row, #formulaone-leaderboard-tab-table .gr-column { width: 100% !important; max-width: 100% !important; }
|
78 |
#formulaone-leaderboard-tab-table [data-testid="dropdown"], #formulaone-leaderboard-tab-table input[type="text"] { width: 100% !important; }
|
79 |
|
80 |
/* Login button: force light */
|
|
|
86 |
}
|
87 |
#hf-login-btn:hover, #hf-login-btn button:hover, button[data-testid="login-button"]:hover, [data-testid="login-button"] button:hover, div[data-testid="login-button"] > button:hover { background: #f9fafb !important; }
|
88 |
|
89 |
+
/* Misc retained */
|
90 |
#models-to-add-text { font-size: 18px !important; }
|
91 |
#citation-button span { font-size: 16px !important; }
|
92 |
#citation-button textarea { font-size: 16px !important; }
|