Jerrycool commited on
Commit
5134a55
·
verified ·
1 Parent(s): 38d4e2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -161
app.py CHANGED
@@ -65,12 +65,13 @@ def update_leaderboard(category):
65
 
66
  # --- Dark Mode Styling ---
67
  font_size_css = """
68
- body { font-size: 1.1em !important; }
69
  """
70
  custom_css += font_size_css
71
 
72
  dark_css = """
73
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
 
74
 
75
  body {
76
  font-family: 'Inter', sans-serif;
@@ -90,213 +91,96 @@ body {
90
  }
91
  .hero-section h1 {
92
  margin: 0;
93
- font-size: 2.8rem !important;
94
  font-weight: 700 !important;
95
- display: flex;
96
- align-items: center;
97
- justify-content: center;
98
- }
99
- .hero-section h1 i {
100
- margin-right: 0.5rem;
101
- color: gold;
102
  }
103
  .hero-section h2 {
104
  margin: .5rem 0 0 !important;
105
- font-size: 1.4rem !important;
106
  font-weight: 400 !important;
107
  opacity: 0.8;
108
  }
109
 
110
  /* Tab Buttons */
111
- .tab-nav-buttons button {
112
  border-radius: 20px !important;
113
- padding: 0.75rem 1.25rem !important;
114
- margin-right: 0.75rem !important;
115
  background: #1e1e1e !important;
116
  color: #e0e0e0 !important;
117
  border: none !important;
118
- transition: all 0.3s ease !important;
119
- font-weight: 600 !important;
120
- font-size: 1.2rem !important;
121
- letter-spacing: 0.02em !important;
122
- box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
123
  }
124
- .tab-nav-buttons button:hover {
125
  background: #2c2c2c !important;
126
- transform: translateY(-2px) !important;
127
- box-shadow: 0 4px 8px rgba(0,0,0,0.3) !important;
128
  }
129
- .tab-nav-buttons button[aria-selected="true"] {
130
- background: linear-gradient(to bottom, #444, #333) !important;
131
  color: #fff !important;
132
- box-shadow: 0 2px 6px rgba(0,0,0,0.4) !important;
133
  }
134
 
135
- /* Category Selector */
136
- #category-selector .wrap {
137
- display: flex;
138
- flex-direction: column;
139
- gap: 0.75rem;
140
- }
141
- #category-selector .label-wrap {
142
- font-size: 1.4rem !important;
143
- font-weight: 600 !important;
144
- color: #e0e0e0 !important;
145
- letter-spacing: 0.02em !important;
146
- margin-bottom: 0.5rem !important;
147
- }
148
  #category-selector input[type="radio"] { display: none; }
149
- #category-selector .options {
150
- display: flex;
151
- flex-direction: row !important;
152
- flex-wrap: wrap;
153
- gap: 0.75rem;
154
- justify-content: space-between;
155
- }
156
  #category-selector label {
157
  display: inline-block;
158
- padding: 0.75rem 1.5rem;
 
159
  border-radius: 999px;
160
  background: #1e1e1e;
161
  cursor: pointer;
162
- transition: all 0.3s ease;
163
  font-weight: 500;
164
  color: #e0e0e0;
165
- letter-spacing: 0.02em;
166
- font-size: 1.15rem;
167
- box-shadow: 0 2px 4px rgba(0,0,0,0.15);
168
- text-align: center;
169
- width: 18%;
170
- margin: 0 !important;
171
- }
172
- #category-selector label:hover {
173
- background: #2a2a2a;
174
- transform: translateY(-2px);
175
- box-shadow: 0 4px 8px rgba(0,0,0,0.2);
176
  }
177
  #category-selector input[type="radio"]:checked + label {
178
- background: linear-gradient(to bottom, #444, #333);
179
  color: #fff;
180
- box-shadow: 0 2px 6px rgba(0,0,0,0.3);
181
- font-weight: 600;
182
  }
183
 
184
  /* Table Styling */
185
- .dataframe-container {
186
- margin-top: 1.5rem;
187
- border-radius: 0.75rem;
188
- overflow: hidden;
189
- box-shadow: 0 4px 12px rgba(0,0,0,0.3);
190
- }
191
  .dataframe-container table {
192
  width: 100%;
193
  border: none;
194
- border-collapse: collapse;
 
 
195
  }
196
  .dataframe-container table th {
197
- background: linear-gradient(to bottom, #333, #2c2c2c);
198
- color: #fff;
199
- font-weight: 600;
200
- font-size: 1.25rem;
201
- text-align: left;
202
- letter-spacing: 0.02em;
203
- padding: 1.2rem 1.5rem;
204
- position: sticky;
205
- top: 0;
206
- box-shadow: 0 2px 4px rgba(0,0,0,0.2);
207
- z-index: 10;
208
  }
209
  .dataframe-container table tr:nth-child(odd) {
210
- background-color: #1a1a1a !important;
211
  }
212
  .dataframe-container table tr:nth-child(even) {
213
- background-color: #222 !important;
214
- }
215
- .dataframe-container table tr:hover {
216
- background-color: #2c2c2c !important;
217
- transition: background-color 0.2s ease;
218
  }
219
- .dataframe-container table td {
220
- padding: 1.1rem 1.5rem;
221
  color: #e0e0e0;
222
- font-size: 1.2rem;
223
- letter-spacing: 0.01em;
224
- border-bottom: 1px solid #333;
225
  }
226
  .dataframe-container table td a {
227
  color: #8ab4f8;
228
  text-decoration: none;
229
- font-weight: 500;
230
- transition: all 0.2s ease;
231
  }
232
  .dataframe-container table td a:hover {
233
  color: #a3c9ff;
234
  text-decoration: underline;
235
  }
236
 
237
- /* Column-specific styles */
238
- .dataframe-container table td:first-child,
239
- .dataframe-container table th:first-child {
240
- text-align: center;
241
- width: 80px;
242
- }
243
- .dataframe-container table td:last-child,
244
- .dataframe-container table th:last-child {
245
- text-align: center;
246
- font-weight: 600;
247
- font-size: 1.3rem;
248
- color: #ffcc00;
249
- }
250
-
251
  /* Enable scrollbar */
252
  #leaderboard-table .dataframe-container {
253
- max-height: 550px !important;
254
  overflow-y: auto !important;
255
  }
256
-
257
- /* Custom Scrollbar for WebKit browsers */
258
- .dataframe-container::-webkit-scrollbar {
259
- width: 10px;
260
- }
261
- .dataframe-container::-webkit-scrollbar-track {
262
- background: #1a1a1a;
263
- border-radius: 5px;
264
- }
265
- .dataframe-container::-webkit-scrollbar-thumb {
266
- background: #444;
267
- border-radius: 5px;
268
- }
269
- .dataframe-container::-webkit-scrollbar-thumb:hover {
270
- background: #555;
271
- }
272
-
273
- /* Markdown text styling */
274
- .markdown-text {
275
- line-height: 1.6;
276
- font-size: 1.2rem;
277
- color: #d0d0d0;
278
- }
279
- .markdown-text h1, .markdown-text h2, .markdown-text h3 {
280
- color: #fff;
281
- font-weight: 600;
282
- margin-top: 1.5rem;
283
- margin-bottom: 1rem;
284
- }
285
- .markdown-text h2 {
286
- font-size: 1.8rem !important;
287
- border-bottom: 1px solid #333;
288
- padding-bottom: 0.5rem;
289
- }
290
- .markdown-text p {
291
- margin-bottom: 1rem;
292
- }
293
  """
294
  custom_css += dark_css
295
 
296
  # --- Override Title ---
297
  TITLE = """
298
- <div class="hero-section">
299
- <h1><i class="fa fa-trophy" style="color: gold;"></i> MLE-Dojo Benchmark Leaderboard</h1>
300
  <h2>Improving LLM Agents for Machine Learning Engineering</h2>
301
  </div>
302
  """
@@ -306,27 +190,24 @@ TITLE = """
306
  demo = gr.Blocks(css=custom_css, theme=gr.themes.Base())
307
 
308
  with demo:
309
- # Inject FontAwesome CSS and JS explicitly in the head
310
  gr.HTML("""
311
- <head>
312
- <link rel="stylesheet"
313
- href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
314
- integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw=="
315
- crossorigin="anonymous" referrerpolicy="no-referrer" />
316
- <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/js/all.min.js"
317
- integrity="sha512-fD9DI5bZwQxOi7MhYWnnNPlvXdp/2Pj3XSTRrFs5FQa4mizyGLnJcN6tuvUS6LbmgN1ut+XGSABKvjN0H6Aoow=="
318
- crossorigin="anonymous" referrerpolicy="no-referrer"></script>
319
- </head>
320
- """)
321
 
322
  # Header & Intro
323
  gr.HTML(TITLE)
324
  gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
325
 
326
- # Tabs - Fix icons by using Font Awesome classes correctly
327
- with gr.Tabs(elem_classes="tab-nav-buttons") as tabs:
328
- with gr.TabItem("📋 Leaderboard"):
329
- gr.Markdown("## Model Elo Rankings by Category", elem_classes="markdown-text")
330
  category_selector = gr.Radio(
331
  choices=CATEGORIES,
332
  label="Select Category:",
@@ -350,7 +231,7 @@ with demo:
350
  outputs=leaderboard_df
351
  )
352
 
353
- with gr.TabItem("ℹ️ About"):
354
  gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
355
 
356
  # Citation Accordion
 
65
 
66
  # --- Dark Mode Styling ---
67
  font_size_css = """
68
+ body { font-size: 1em !important; }
69
  """
70
  custom_css += font_size_css
71
 
72
  dark_css = """
73
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
74
+ @import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');
75
 
76
  body {
77
  font-family: 'Inter', sans-serif;
 
91
  }
92
  .hero-section h1 {
93
  margin: 0;
94
+ font-size: 2.5rem !important;
95
  font-weight: 700 !important;
 
 
 
 
 
 
 
96
  }
97
  .hero-section h2 {
98
  margin: .5rem 0 0 !important;
99
+ font-size: 1.25rem !important;
100
  font-weight: 400 !important;
101
  opacity: 0.8;
102
  }
103
 
104
  /* Tab Buttons */
105
+ .tab-buttons button {
106
  border-radius: 20px !important;
107
+ padding: 0.5rem 1rem !important;
108
+ margin-right: 0.5rem !important;
109
  background: #1e1e1e !important;
110
  color: #e0e0e0 !important;
111
  border: none !important;
112
+ transition: background 0.3s !important;
113
+ font-weight: 500 !important;
 
 
 
114
  }
115
+ .tab-buttons button:hover {
116
  background: #2c2c2c !important;
 
 
117
  }
118
+ .tab-buttons button[aria-selected="true"] {
119
+ background: #444 !important;
120
  color: #fff !important;
 
121
  }
122
 
123
+ /* Category Selector Pills */
 
 
 
 
 
 
 
 
 
 
 
 
124
  #category-selector input[type="radio"] { display: none; }
 
 
 
 
 
 
 
125
  #category-selector label {
126
  display: inline-block;
127
+ padding: 0.5rem 1rem;
128
+ margin-right: 0.5rem;
129
  border-radius: 999px;
130
  background: #1e1e1e;
131
  cursor: pointer;
132
+ transition: background 0.3s, color 0.3s;
133
  font-weight: 500;
134
  color: #e0e0e0;
 
 
 
 
 
 
 
 
 
 
 
135
  }
136
  #category-selector input[type="radio"]:checked + label {
137
+ background: #444;
138
  color: #fff;
 
 
139
  }
140
 
141
  /* Table Styling */
 
 
 
 
 
 
142
  .dataframe-container table {
143
  width: 100%;
144
  border: none;
145
+ box-shadow: 0 2px 4px rgba(0,0,0,0.5);
146
+ border-radius: 0.5rem;
147
+ overflow: hidden;
148
  }
149
  .dataframe-container table th {
150
+ background: #2c2c2c;
151
+ color: #e0e0e0;
 
 
 
 
 
 
 
 
 
152
  }
153
  .dataframe-container table tr:nth-child(odd) {
154
+ background-color: #1e1e1e !important;
155
  }
156
  .dataframe-container table tr:nth-child(even) {
157
+ background-color: #252525 !important;
 
 
 
 
158
  }
159
+ .dataframe-container table td, .dataframe-container table th {
160
+ padding: 0.75rem 1rem;
161
  color: #e0e0e0;
 
 
 
162
  }
163
  .dataframe-container table td a {
164
  color: #8ab4f8;
165
  text-decoration: none;
 
 
166
  }
167
  .dataframe-container table td a:hover {
168
  color: #a3c9ff;
169
  text-decoration: underline;
170
  }
171
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  /* Enable scrollbar */
173
  #leaderboard-table .dataframe-container {
174
+ max-height: 400px !important;
175
  overflow-y: auto !important;
176
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  """
178
  custom_css += dark_css
179
 
180
  # --- Override Title ---
181
  TITLE = """
182
+ <div class=\"hero-section\">
183
+ <h1><i class=\"fas fa-trophy\"></i> MLE-Dojo Benchmark Leaderboard</h1>
184
  <h2>Improving LLM Agents for Machine Learning Engineering</h2>
185
  </div>
186
  """
 
190
  demo = gr.Blocks(css=custom_css, theme=gr.themes.Base())
191
 
192
  with demo:
193
+ # Inject FontAwesome JS/CSS explicitly
194
  gr.HTML("""
195
+ <link rel=\"stylesheet\"
196
+ href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css\"
197
+ crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"/>
198
+ <script src=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/js/all.min.js\"
199
+ crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>
200
+ """
201
+ )
 
 
 
202
 
203
  # Header & Intro
204
  gr.HTML(TITLE)
205
  gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
206
 
207
+ # Tabs
208
+ with gr.Tabs(elem_classes="tab-buttons") as tabs:
209
+ with gr.TabItem("<i class='fas fa-list'></i> Leaderboard"):
210
+ gr.Markdown("## Model Elo Rankings by Category")
211
  category_selector = gr.Radio(
212
  choices=CATEGORIES,
213
  label="Select Category:",
 
231
  outputs=leaderboard_df
232
  )
233
 
234
+ with gr.TabItem("<i class='fas fa-info-circle'></i> About"):
235
  gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
236
 
237
  # Citation Accordion