Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update.
Browse files- app.py +12 -15
- src/about.py +170 -120
- src/display/css_html_js.py +176 -87
app.py
CHANGED
@@ -176,20 +176,16 @@ def get_theme():
|
|
176 |
return "light"
|
177 |
|
178 |
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
"
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
"
|
188 |
-
" } catch (e) {}\n"
|
189 |
-
"}"
|
190 |
)
|
191 |
-
|
192 |
-
blocks = gr.Blocks(css=custom_css, theme=get_theme(), js=_force_light_js)
|
193 |
with blocks:
|
194 |
|
195 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
@@ -219,8 +215,9 @@ with blocks:
|
|
219 |
|
220 |
login_box = gr.Group(visible=True)
|
221 |
with login_box:
|
222 |
-
gr.Markdown("Please sign in with Hugging Face to submit"
|
223 |
-
|
|
|
224 |
|
225 |
submit_panel = gr.Group(visible=False)
|
226 |
with submit_panel:
|
|
|
176 |
return "light"
|
177 |
|
178 |
|
179 |
+
blocks = gr.Blocks(
|
180 |
+
css=custom_css,
|
181 |
+
theme=get_theme(),
|
182 |
+
js="""() => {
|
183 |
+
// Force light everywhere
|
184 |
+
document.documentElement.setAttribute('data-theme', 'light');
|
185 |
+
document.documentElement.setAttribute('data-color-mode', 'light');
|
186 |
+
document.body.classList.remove('dark');
|
187 |
+
}""",
|
|
|
|
|
188 |
)
|
|
|
|
|
189 |
with blocks:
|
190 |
|
191 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
|
|
215 |
|
216 |
login_box = gr.Group(visible=True)
|
217 |
with login_box:
|
218 |
+
gr.Markdown("Please sign in with Hugging Face to submit")
|
219 |
+
# Give the login button a stable id so CSS can target it
|
220 |
+
gr.LoginButton(elem_id="hf-login-btn")
|
221 |
|
222 |
submit_panel = gr.Group(visible=False)
|
223 |
with submit_panel:
|
src/about.py
CHANGED
@@ -3,151 +3,201 @@ PAPER_URL = "https://arxiv.org/abs/2507.13337"
|
|
3 |
|
4 |
WHAT_IS_F1_HTML = f"""
|
5 |
<!DOCTYPE html>
|
6 |
-
<html lang
|
7 |
<body>
|
8 |
-
<main class
|
9 |
-
<header class
|
10 |
-
<h1 class
|
11 |
</header>
|
|
|
12 |
<section>
|
13 |
-
<p class
|
14 |
-
|
15 |
-
<p class
|
16 |
-
|
17 |
-
|
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 |
-
</tbody>
|
48 |
-
</table>
|
49 |
</div>
|
50 |
|
51 |
-
<!--
|
52 |
-
<div class
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
<
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
</div>
|
63 |
-
|
64 |
-
|
65 |
-
<
|
|
|
|
|
66 |
</div>
|
67 |
-
</div>
|
68 |
-
<div class=\"f1-tabs-bar\" role=\"tablist\" aria-label=\"Example tiers\">
|
69 |
-
<button class=\"f1-tab-btn is-active\" data-target=\"f1-tab-warmup\" role=\"tab\" aria-controls=\"f1-tab-warmup\" aria-selected=\"true\">Warmup</button>
|
70 |
-
<button class=\"f1-tab-btn\" data-target=\"f1-tab-tier1\" role=\"tab\" aria-controls=\"f1-tab-tier1\">Tier 1</button>
|
71 |
-
<button class=\"f1-tab-btn\" data-target=\"f1-tab-tier2\" role=\"tab\" aria-controls=\"f1-tab-tier2\">Tier 2</button>
|
72 |
-
</div>
|
73 |
</div>
|
74 |
|
75 |
-
<p class
|
76 |
-
|
|
|
77 |
</section>
|
|
|
78 |
<section>
|
79 |
-
<h2 class
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
<p class
|
|
|
|
|
84 |
</div>
|
85 |
-
|
86 |
-
<
|
87 |
-
|
88 |
-
<
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
</figure>
|
92 |
-
|
93 |
-
<
|
94 |
-
|
95 |
-
|
|
|
|
|
96 |
Your browser does not support the video tag.
|
97 |
</video>
|
98 |
-
<figcaption class
|
99 |
</figure>
|
100 |
-
|
|
|
101 |
</section>
|
102 |
-
|
103 |
-
|
104 |
-
<
|
105 |
-
|
106 |
-
<
|
107 |
-
|
108 |
-
|
109 |
-
|
|
|
|
|
|
|
110 |
</ul>
|
111 |
-
|
112 |
-
<p class
|
113 |
-
|
114 |
-
<p class
|
115 |
-
|
116 |
-
|
117 |
-
|
|
|
|
|
|
|
|
|
|
|
118 |
</figure>
|
119 |
-
|
120 |
-
<
|
121 |
-
|
122 |
-
|
|
|
|
|
123 |
</figure>
|
124 |
-
|
|
|
125 |
</section>
|
126 |
</main>
|
127 |
|
128 |
-
<!-- MathJax for LaTeX
|
129 |
-
<script
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
<script>
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
</script>
|
152 |
</body>
|
153 |
</html>
|
|
|
3 |
|
4 |
WHAT_IS_F1_HTML = f"""
|
5 |
<!DOCTYPE html>
|
6 |
+
<html lang="en">
|
7 |
<body>
|
8 |
+
<main class="f1-container">
|
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 |
+
<!-- (3) Minimal table for categories -->
|
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 |
+
<!-- (4) Bottom-tabbed problem viewer -->
|
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="mb-2 f1-p"><strong>Union-of-Paths-and-Cycles.</strong></p>
|
58 |
+
<p class="mb-2 f1-p"><strong>Objective:</strong> 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="mb-2 f1-p"><strong>Maximal-Union-of-Paths-and-Cycles.</strong></p>
|
65 |
+
<p class="mb-2 f1-p"><strong>Objective:</strong> 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="mb-2 f1-p"><strong>Maximal-Union-of-Cycles.</strong></p>
|
72 |
+
<p class="mb-2 f1-p"><strong>Objective:</strong> 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="mt-6 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 |
+
<!-- (5) Problem 44: LaTeX, with heading removed -->
|
93 |
+
<div class="f1-problem-box">
|
94 |
+
<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>
|
95 |
+
<p class="mb-2 f1-p"><strong>Objective:</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>
|
96 |
+
<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>
|
97 |
</div>
|
98 |
+
|
99 |
+
<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>
|
100 |
+
|
101 |
+
<blockquote class="my-6 f1-blockquote">
|
102 |
+
“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.”
|
103 |
+
</blockquote>
|
104 |
+
|
105 |
+
<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>
|
106 |
+
|
107 |
+
<figure class="f1-figure">
|
108 |
+
<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">
|
109 |
+
<figcaption class="f1-figcaption">An illustration of local modifications to bags: Introduce, Forget, and Join.</figcaption>
|
110 |
</figure>
|
111 |
+
|
112 |
+
<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>
|
113 |
+
|
114 |
+
<figure class="f1-figure">
|
115 |
+
<video class="w-full max-w-2xl mx-auto rounded-lg shadow-lg" autoplay loop muted playsinline>
|
116 |
+
<source src="/file=assets/dp_animation.mp4" type="video/mp4">
|
117 |
Your browser does not support the video tag.
|
118 |
</video>
|
119 |
+
<figcaption class="f1-figcaption">Animation showing the design of a compressed dynamic programming state-space.</figcaption>
|
120 |
</figure>
|
121 |
+
|
122 |
+
<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>
|
123 |
</section>
|
124 |
+
|
125 |
+
<section id="evaluation">
|
126 |
+
<h2 class="text-3xl font-bold text-gray-900 f1-h2">Evaluation</h2>
|
127 |
+
|
128 |
+
<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>
|
129 |
+
|
130 |
+
<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>
|
131 |
+
<ul class="list-disc list-inside space-y-2 mb-6">
|
132 |
+
<li class="f1-li"><strong>Correctness:</strong> The output of the submitted algorithm must be correct on all graphs.</li>
|
133 |
+
<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>
|
134 |
+
<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>
|
135 |
</ul>
|
136 |
+
|
137 |
+
<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>
|
138 |
+
|
139 |
+
<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>
|
140 |
+
|
141 |
+
<h3 class="text-2xl font-bold text-gray-900 mt-8 mb-4">Model Accuracy</h3>
|
142 |
+
|
143 |
+
<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>
|
144 |
+
|
145 |
+
<figure class="f1-figure">
|
146 |
+
<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">
|
147 |
+
<figcaption class="f1-figcaption">Performance of frontier models on the FormulaOne-Warmup dataset.</figcaption>
|
148 |
</figure>
|
149 |
+
|
150 |
+
<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>
|
151 |
+
|
152 |
+
<figure class="f1-figure">
|
153 |
+
<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">
|
154 |
+
<figcaption class="f1-figcaption">Figure 1: Performance of frontier reasoning models on the FormulaOne dataset.</figcaption>
|
155 |
</figure>
|
156 |
+
|
157 |
+
<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>
|
158 |
</section>
|
159 |
</main>
|
160 |
|
161 |
+
<!-- MathJax for LaTeX (loaded once) -->
|
162 |
+
<script>
|
163 |
+
if (!window.MathJax) {{
|
164 |
+
const mj = document.createElement('script');
|
165 |
+
mj.src = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js";
|
166 |
+
mj.async = true;
|
167 |
+
document.head.appendChild(mj);
|
168 |
+
}}
|
169 |
+
</script>
|
170 |
|
171 |
<script>
|
172 |
+
// Because gr.HTML mounts asynchronously, wait a tick then wire up tabs.
|
173 |
+
setTimeout(() => {{
|
174 |
+
const tabs = [
|
175 |
+
{{button: document.getElementById('tab-warmup'), panel: document.getElementById('panel-warmup') }},
|
176 |
+
{{button: document.getElementById('tab-tier1'), panel: document.getElementById('panel-tier1') }},
|
177 |
+
{{button: document.getElementById('tab-tier2'), panel: document.getElementById('panel-tier2') }},
|
178 |
+
]];
|
179 |
+
|
180 |
+
function selectTab(idx) {{
|
181 |
+
tabs.forEach((t, i) => {{
|
182 |
+
const sel = (i === idx);
|
183 |
+
if (!t.button || !t.panel) return;
|
184 |
+
t.button.setAttribute('aria-selected', sel ? 'true' : 'false');
|
185 |
+
t.panel.style.display = sel ? '' : 'none';
|
186 |
+
}});
|
187 |
+
if (window.MathJax && window.MathJax.typesetPromise) {{
|
188 |
+
window.MathJax.typesetPromise();
|
189 |
+
}}
|
190 |
+
}}
|
191 |
+
|
192 |
+
tabs.forEach((t, i) => {{
|
193 |
+
if (t.button) {{
|
194 |
+
t.button.addEventListener('click', () => selectTab(i));
|
195 |
+
}}
|
196 |
+
}});
|
197 |
+
|
198 |
+
// Initial state
|
199 |
+
selectTab(0);
|
200 |
+
}}, 120);
|
201 |
</script>
|
202 |
</body>
|
203 |
</html>
|
src/display/css_html_js.py
CHANGED
@@ -1,41 +1,200 @@
|
|
1 |
custom_css = """
|
2 |
-
/* Typography
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
8 |
}
|
9 |
|
10 |
-
/*
|
11 |
-
.
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
-
|
|
|
|
|
|
|
|
|
16 |
|
17 |
-
/*
|
|
|
|
|
|
|
|
|
18 |
button[role="tab"] {
|
19 |
-
font-family: '
|
20 |
-
letter-spacing: 0.
|
21 |
font-weight: 600;
|
22 |
font-size: 18px !important;
|
23 |
}
|
24 |
-
.tab-buttons button { font-size:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
|
|
26 |
#models-to-add-text { font-size: 18px !important; }
|
27 |
#citation-button span { font-size: 16px !important; }
|
28 |
#citation-button textarea { font-size: 16px !important; }
|
29 |
#citation-button > label > button { margin: 6px; transform: scale(1.3); }
|
30 |
-
|
31 |
-
/* Leaderboard spacing */
|
32 |
#leaderboard-table { margin-top: 15px }
|
33 |
#leaderboard-table-lite { margin-top: 15px }
|
34 |
#search-bar-table-box > div:first-child { background: none; border: none; }
|
35 |
#search-bar { padding: 0px; }
|
36 |
#leaderboard-table td:nth-child(2),
|
37 |
#leaderboard-table th:nth-child(2) { max-width: 400px; overflow: auto; white-space: nowrap; }
|
38 |
-
|
39 |
#scale-logo { border-style: none !important; box-shadow: none; display: block; margin-left: auto; margin-right: auto; max-width: 600px; }
|
40 |
#scale-logo .download { display: none; }
|
41 |
#filter_type{ border: 0; padding-left: 0; padding-top: 0; }
|
@@ -47,76 +206,6 @@ button[role="tab"] {
|
|
47 |
#filter-columns-type{ border:0; padding:0.5; }
|
48 |
#filter-columns-size{ border:0; padding:0.5; }
|
49 |
#box-filter > .form{ border: 0 }
|
50 |
-
|
51 |
-
/* ---------- "What is FormulaOne" (HTML) ---------- */
|
52 |
-
/* Constrain width of the whole page section */
|
53 |
-
.f1-container { max-width: 900px; margin: 0 auto; padding: 0 1rem; }
|
54 |
-
|
55 |
-
/* Heading spacing fix */
|
56 |
-
.f1-h1 { font-weight: 700; font-size: 2.5rem; line-height: 1.1; color: #111827; text-align: center; margin-bottom: 1.25rem !important; }
|
57 |
-
|
58 |
-
.f1-h2 { font-weight: 700; border-bottom: 1px solid #e5e7eb; padding-bottom: 0.5rem; margin-top: 2.25rem; margin-bottom: 1rem; color: #111827; font-size: 1.75rem; line-height: 2.1rem; }
|
59 |
-
.f1-p, .f1-li { line-height: 1.75; color: #374151; }
|
60 |
-
.f1-a { color: #2563eb; text-decoration: none; font-weight: 500; }
|
61 |
-
.f1-a:hover { text-decoration: underline; }
|
62 |
-
.f1-blockquote { border-left: 4px solid #d1d5db; padding-left: 1rem; margin-left: 0; font-style: italic; color: #4b5563; background: #fafafa; }
|
63 |
-
.f1-problem-box { background-color: #f9fafb; border: 1px solid #e5e7eb; border-radius: 0.75rem; padding: 1.25rem 1.25rem; margin-top: 1.25rem; margin-bottom: 1.25rem; box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); }
|
64 |
-
.f1-figure { margin-top: 1.25rem; margin-bottom: 1.25rem; text-align: center; }
|
65 |
-
.f1-figcaption { margin-top: 0.5rem; font-size: 0.9rem; color: #6b7280; font-style: italic; }
|
66 |
-
|
67 |
-
/* Beautiful table for Warmup / Tier 1 / Tier 2 */
|
68 |
-
.f1-table-wrapper { margin: 1.5rem 0; overflow-x: auto; }
|
69 |
-
.f1-table { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid #e5e7eb; border-radius: 0.75rem; box-shadow: 0 1px 2px 0 rgba(0,0,0,0.04); }
|
70 |
-
.f1-table thead th { background: #f3f4f6; color: #111827; font-weight: 700; text-align: left; padding: 0.85rem 1rem; border-bottom: 1px solid #e5e7eb; }
|
71 |
-
.f1-table tbody td { padding: 0.75rem 1rem; color: #374151; border-bottom: 1px solid #f1f5f9; }
|
72 |
-
.f1-table tbody tr:nth-child(odd) td { background: #fafafa; }
|
73 |
-
.f1-table tbody tr:last-child td { border-bottom: none; }
|
74 |
-
.f1-table th:first-child, .f1-table td:first-child { border-top-left-radius: 0.75rem; }
|
75 |
-
.f1-table th:last-child, .f1-table td:last-child { border-top-right-radius: 0.75rem; }
|
76 |
-
|
77 |
-
/* Bottom tabs: "Examples of FormulaOne problems" */
|
78 |
-
.f1-tabs { border: 1px solid #e5e7eb; border-radius: 0.75rem; background: #fff; box-shadow: 0 1px 2px 0 rgba(0,0,0,0.04); margin-top: 1.25rem; }
|
79 |
-
.f1-tabs .f1-tabs-header { padding: 1rem 1rem 0 1rem; font-weight: 700; color: #111827; font-size: 1.1rem; }
|
80 |
-
.f1-tabs .f1-tabs-content { padding: 1rem; }
|
81 |
-
.f1-tabs .f1-tabs-bar { display: flex; gap: 0.5rem; justify-content: center; border-top: 1px solid #e5e7eb; padding: 0.6rem; background: #fafafa; border-bottom-left-radius: 0.75rem; border-bottom-right-radius: 0.75rem; }
|
82 |
-
.f1-tabs .f1-tab-btn { appearance: none; border: 1px solid #d1d5db; background: #ffffff; padding: 0.45rem 0.9rem; border-radius: 999px; font-weight: 600; font-size: 0.95rem; color: #374151; cursor: pointer; transition: all 120ms ease; }
|
83 |
-
.f1-tabs .f1-tab-btn:hover { transform: translateY(-1px); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
|
84 |
-
.f1-tabs .f1-tab-btn.is-active { background: #2563eb; color: white; border-color: #2563eb; box-shadow: 0 1px 2px rgba(37,99,235,.35); }
|
85 |
-
|
86 |
-
/* Code blocks in citation look cleaner */
|
87 |
-
#citation-block { border-radius: 0.5rem; }
|
88 |
-
|
89 |
-
/* Nice cards used elsewhere */
|
90 |
-
.f1-category-card { display: block; border-radius: 0.5rem; border: 1px solid #e5e7eb; padding: 1rem; background-color: white; box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); }
|
91 |
-
|
92 |
-
/* Login Button — force light */
|
93 |
-
div[data-testid="login-button"] > button,
|
94 |
-
button.sso-button,
|
95 |
-
[data-testid="login-button"] button,
|
96 |
-
button[data-testid="oauth-login"],
|
97 |
-
.gr-login button {
|
98 |
-
background: #ffffff !important;
|
99 |
-
color: #374151 !important;
|
100 |
-
border: 1px solid #d1d5db !important;
|
101 |
-
}
|
102 |
-
div[data-testid="login-button"] > button:hover,
|
103 |
-
button.sso-button:hover,
|
104 |
-
[data-testid="login-button"] button:hover,
|
105 |
-
button[data-testid="oauth-login"]:hover,
|
106 |
-
.gr-login button:hover { background: #f9fafb !important; }
|
107 |
-
|
108 |
-
/* Leaderboard controls should stretch full width */
|
109 |
-
#formulaone-leaderboard-tab-table .gr-row,
|
110 |
-
#formulaone-leaderboard-tab-table .gr-column { width: 100% !important; }
|
111 |
-
#formulaone-leaderboard-tab-table input[type="text"],
|
112 |
-
#formulaone-leaderboard-tab-table select,
|
113 |
-
#formulaone-leaderboard-tab-table .wrap,
|
114 |
-
#formulaone-leaderboard-tab-table .wrap-inner,
|
115 |
-
#formulaone-leaderboard-tab-table .container { width: 100% !important; max-width: 100% !important; }
|
116 |
-
|
117 |
-
/* Light theme enforcement if outer shell is dark */
|
118 |
-
html.dark, body.dark { background: #ffffff !important; color-scheme: light; }
|
119 |
-
html.dark *, body.dark * { --tw-ring-color: rgba(37, 99, 235, 0.4); }
|
120 |
"""
|
121 |
|
122 |
get_window_url_params = """
|
|
|
1 |
custom_css = """
|
2 |
+
/* Typography & readable width */
|
3 |
+
:root, [data-theme="light"] {
|
4 |
+
--f1-text: #111827;
|
5 |
+
--f1-subtle: #6b7280;
|
6 |
+
--f1-border: #e5e7eb;
|
7 |
+
--f1-bg: #ffffff;
|
8 |
+
--f1-bg-muted: #f9fafb;
|
9 |
}
|
10 |
|
11 |
+
/* Narrow the content for nicer paragraphs */
|
12 |
+
.f1-container {
|
13 |
+
max-width: 800px; /* (2) max width = 800 */
|
14 |
+
margin: 0 auto;
|
15 |
+
padding: 0 16px;
|
16 |
+
}
|
17 |
|
18 |
+
/* Paragraphs and list items: pleasant wrapping without weird spacings */
|
19 |
+
.f1-p, .f1-li {
|
20 |
+
line-height: 1.75;
|
21 |
+
color: #374151;
|
22 |
+
text-align: left; /* (5) ensure no justified gaps */
|
23 |
+
text-wrap: pretty; /* modern browsers: better line breaks */
|
24 |
+
overflow-wrap: break-word; /* break long tokens if needed */
|
25 |
+
hyphens: auto; /* allow soft hyphenation where possible */
|
26 |
+
word-break: normal;
|
27 |
+
}
|
28 |
|
29 |
+
.markdown-text {
|
30 |
+
font-size: 16px !important;
|
31 |
+
max-width: 800px; /* match content width for markdown blocks too */
|
32 |
+
margin: 0 auto;
|
33 |
+
}
|
34 |
|
35 |
+
/* Banner image */
|
36 |
+
.banner_image { width: 75% !important; align-self: center !important; }
|
37 |
+
|
38 |
+
/* Tabs (Gradio) */
|
39 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@500;600&display=swap');
|
40 |
button[role="tab"] {
|
41 |
+
font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
|
42 |
+
letter-spacing: 0.2px;
|
43 |
font-weight: 600;
|
44 |
font-size: 18px !important;
|
45 |
}
|
46 |
+
.tab-buttons button { font-size: 18px; }
|
47 |
+
|
48 |
+
/* Headings */
|
49 |
+
.f1-h1 {
|
50 |
+
font-weight: 700;
|
51 |
+
font-size: 2.25rem;
|
52 |
+
line-height: 2.5rem;
|
53 |
+
color: var(--f1-text);
|
54 |
+
text-align: center;
|
55 |
+
margin-bottom: 1.25rem !important; /* (1) reduce gap under main title */
|
56 |
+
}
|
57 |
+
.f1-h2 {
|
58 |
+
font-weight: 700;
|
59 |
+
border-bottom: 1px solid var(--f1-border);
|
60 |
+
padding-bottom: 0.5rem;
|
61 |
+
margin-top: 2.25rem;
|
62 |
+
margin-bottom: 1.25rem;
|
63 |
+
color: var(--f1-text);
|
64 |
+
font-size: 1.875rem;
|
65 |
+
line-height: 2.25rem;
|
66 |
+
}
|
67 |
+
|
68 |
+
/* Links */
|
69 |
+
.f1-a { color: #2563eb; text-decoration: none; font-weight: 500; }
|
70 |
+
.f1-a:hover { text-decoration: underline; }
|
71 |
+
|
72 |
+
/* Blockquote & problem box */
|
73 |
+
.f1-blockquote {
|
74 |
+
border-left: 4px solid #d1d5db;
|
75 |
+
padding-left: 1rem;
|
76 |
+
margin-left: 0;
|
77 |
+
font-style: italic;
|
78 |
+
color: #4b5563;
|
79 |
+
}
|
80 |
+
.f1-problem-box {
|
81 |
+
background-color: var(--f1-bg-muted);
|
82 |
+
border: 1px solid var(--f1-border);
|
83 |
+
border-radius: 8px;
|
84 |
+
padding: 16px;
|
85 |
+
margin-top: 16px;
|
86 |
+
margin-bottom: 16px;
|
87 |
+
box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04);
|
88 |
+
}
|
89 |
+
.f1-problem-box strong { color: var(--f1-text); }
|
90 |
+
|
91 |
+
/* Figures */
|
92 |
+
.f1-figure { margin-top: 1.25rem; margin-bottom: 1.25rem; text-align: center; }
|
93 |
+
.f1-figcaption { margin-top: 0.5rem; font-size: 0.875rem; color: var(--f1-subtle); font-style: italic; }
|
94 |
+
|
95 |
+
/* (3) Minimal table styling */
|
96 |
+
.f1-table-wrap {
|
97 |
+
margin: 12px 0 8px 0;
|
98 |
+
}
|
99 |
+
.f1-table {
|
100 |
+
width: 100%;
|
101 |
+
border-collapse: collapse;
|
102 |
+
border: 1px solid var(--f1-border);
|
103 |
+
border-radius: 8px;
|
104 |
+
overflow: hidden; /* keep rounded corners */
|
105 |
+
background: var(--f1-bg);
|
106 |
+
}
|
107 |
+
.f1-table th, .f1-table td {
|
108 |
+
padding: 10px 12px;
|
109 |
+
border-bottom: 1px solid var(--f1-border);
|
110 |
+
text-align: left;
|
111 |
+
vertical-align: top;
|
112 |
+
}
|
113 |
+
.f1-table th {
|
114 |
+
font-weight: 600;
|
115 |
+
color: var(--f1-text);
|
116 |
+
background: #fff; /* ultra-minimal */
|
117 |
+
}
|
118 |
+
.f1-table tr:last-child td { border-bottom: none; }
|
119 |
+
|
120 |
+
/* (4) Bottom tabs: quiet, compact */
|
121 |
+
.f1-tabs {
|
122 |
+
border: 1px solid var(--f1-border);
|
123 |
+
border-radius: 8px;
|
124 |
+
background: var(--f1-bg);
|
125 |
+
}
|
126 |
+
.f1-tabs-body {
|
127 |
+
padding: 12px 14px 6px 14px;
|
128 |
+
}
|
129 |
+
.f1-tabs-buttons {
|
130 |
+
display: flex;
|
131 |
+
gap: 6px;
|
132 |
+
border-top: 1px solid var(--f1-border);
|
133 |
+
padding: 6px;
|
134 |
+
justify-content: flex-start;
|
135 |
+
}
|
136 |
+
.f1-tab-btn {
|
137 |
+
font: 500 13px/1 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
138 |
+
padding: 6px 10px;
|
139 |
+
border-radius: 6px;
|
140 |
+
border: 1px solid transparent;
|
141 |
+
background: transparent;
|
142 |
+
color: #374151;
|
143 |
+
cursor: pointer;
|
144 |
+
}
|
145 |
+
.f1-tab-btn[aria-selected="true"] {
|
146 |
+
background: var(--f1-bg-muted);
|
147 |
+
border-color: var(--f1-border);
|
148 |
+
}
|
149 |
+
|
150 |
+
/* Category cards (kept for other use, not used in the table now) */
|
151 |
+
.f1-category-card {
|
152 |
+
display: block;
|
153 |
+
border-radius: 0.5rem;
|
154 |
+
border: 1px solid var(--f1-border);
|
155 |
+
padding: 1rem;
|
156 |
+
background-color: var(--f1-bg);
|
157 |
+
box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
|
158 |
+
}
|
159 |
+
|
160 |
+
/* Leaderboard width helpers (7) */
|
161 |
+
#formulaone-leaderboard-tab-table .gr-row,
|
162 |
+
#formulaone-leaderboard-tab-table .gr-column {
|
163 |
+
width: 100% !important;
|
164 |
+
}
|
165 |
+
#formulaone-leaderboard-tab-table [data-testid="dropdown"] { width: 100% !important; }
|
166 |
+
#formulaone-leaderboard-tab-table input[type="text"] { width: 100% !important; }
|
167 |
+
|
168 |
+
/* Login button force light (6)(7) */
|
169 |
+
#hf-login-btn,
|
170 |
+
#hf-login-btn button,
|
171 |
+
button[data-testid="login-button"],
|
172 |
+
[data-testid="login-button"] button,
|
173 |
+
div[data-testid="login-button"] > button {
|
174 |
+
background: #ffffff !important;
|
175 |
+
color: #1f2937 !important;
|
176 |
+
border: 1px solid var(--f1-border) !important;
|
177 |
+
box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04) !important;
|
178 |
+
}
|
179 |
+
#hf-login-btn:hover,
|
180 |
+
#hf-login-btn button:hover,
|
181 |
+
button[data-testid="login-button"]:hover,
|
182 |
+
[data-testid="login-button"] button:hover,
|
183 |
+
div[data-testid="login-button"] > button:hover {
|
184 |
+
background: #f9fafb !important;
|
185 |
+
}
|
186 |
|
187 |
+
/* Misc existing */
|
188 |
#models-to-add-text { font-size: 18px !important; }
|
189 |
#citation-button span { font-size: 16px !important; }
|
190 |
#citation-button textarea { font-size: 16px !important; }
|
191 |
#citation-button > label > button { margin: 6px; transform: scale(1.3); }
|
|
|
|
|
192 |
#leaderboard-table { margin-top: 15px }
|
193 |
#leaderboard-table-lite { margin-top: 15px }
|
194 |
#search-bar-table-box > div:first-child { background: none; border: none; }
|
195 |
#search-bar { padding: 0px; }
|
196 |
#leaderboard-table td:nth-child(2),
|
197 |
#leaderboard-table th:nth-child(2) { max-width: 400px; overflow: auto; white-space: nowrap; }
|
|
|
198 |
#scale-logo { border-style: none !important; box-shadow: none; display: block; margin-left: auto; margin-right: auto; max-width: 600px; }
|
199 |
#scale-logo .download { display: none; }
|
200 |
#filter_type{ border: 0; padding-left: 0; padding-top: 0; }
|
|
|
206 |
#filter-columns-type{ border:0; padding:0.5; }
|
207 |
#filter-columns-size{ border:0; padding:0.5; }
|
208 |
#box-filter > .form{ border: 0 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
"""
|
210 |
|
211 |
get_window_url_params = """
|