Jerrycool commited on
Commit
96a6e4d
·
verified ·
1 Parent(s): 9100dd2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +147 -40
app.py CHANGED
@@ -71,7 +71,6 @@ 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;
@@ -93,6 +92,13 @@ body {
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;
@@ -102,85 +108,183 @@ body {
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,24 +294,27 @@ TITLE = """
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,7 +338,7 @@ with demo:
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
@@ -246,4 +353,4 @@ with demo:
246
 
247
  if __name__ == "__main__":
248
  print("Launching Gradio App in Dark Mode...")
249
- demo.launch()
 
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;
 
92
  margin: 0;
93
  font-size: 2.5rem !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;
 
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.05rem !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.15rem !important;
143
+ font-weight: 600 !important;
144
+ color: #e0e0e0 !important;
145
+ letter-spacing: 0.02em !important;
146
+ margin-bottom: 0.25rem !important;
147
+ }
148
  #category-selector input[type="radio"] { display: none; }
149
+ #category-selector .options {
150
+ display: flex;
151
+ flex-wrap: wrap;
152
+ gap: 0.75rem;
153
+ }
154
  #category-selector label {
155
  display: inline-block;
156
+ padding: 0.65rem 1.25rem;
 
157
  border-radius: 999px;
158
  background: #1e1e1e;
159
  cursor: pointer;
160
+ transition: all 0.3s ease;
161
  font-weight: 500;
162
  color: #e0e0e0;
163
+ letter-spacing: 0.02em;
164
+ font-size: 1.05rem;
165
+ box-shadow: 0 2px 4px rgba(0,0,0,0.15);
166
+ }
167
+ #category-selector label:hover {
168
+ background: #2a2a2a;
169
+ transform: translateY(-2px);
170
+ box-shadow: 0 4px 8px rgba(0,0,0,0.2);
171
  }
172
  #category-selector input[type="radio"]:checked + label {
173
+ background: linear-gradient(to bottom, #444, #333);
174
  color: #fff;
175
+ box-shadow: 0 2px 6px rgba(0,0,0,0.3);
176
+ font-weight: 600;
177
  }
178
 
179
  /* Table Styling */
180
+ .dataframe-container {
181
+ margin-top: 1.5rem;
182
+ border-radius: 0.75rem;
183
+ overflow: hidden;
184
+ box-shadow: 0 4px 12px rgba(0,0,0,0.3);
185
+ }
186
  .dataframe-container table {
187
  width: 100%;
188
  border: none;
189
+ border-collapse: collapse;
 
 
190
  }
191
  .dataframe-container table th {
192
+ background: linear-gradient(to bottom, #333, #2c2c2c);
193
+ color: #fff;
194
+ font-weight: 600;
195
+ font-size: 1.1rem;
196
+ text-align: left;
197
+ letter-spacing: 0.02em;
198
+ padding: 1rem 1.25rem;
199
+ position: sticky;
200
+ top: 0;
201
+ box-shadow: 0 2px 4px rgba(0,0,0,0.2);
202
+ z-index: 10;
203
  }
204
  .dataframe-container table tr:nth-child(odd) {
205
+ background-color: #1a1a1a !important;
206
  }
207
  .dataframe-container table tr:nth-child(even) {
208
+ background-color: #222 !important;
209
+ }
210
+ .dataframe-container table tr:hover {
211
+ background-color: #2c2c2c !important;
212
+ transition: background-color 0.2s ease;
213
  }
214
+ .dataframe-container table td {
215
+ padding: 0.9rem 1.25rem;
216
  color: #e0e0e0;
217
+ font-size: 1.05rem;
218
+ letter-spacing: 0.01em;
219
+ border-bottom: 1px solid #333;
220
  }
221
  .dataframe-container table td a {
222
  color: #8ab4f8;
223
  text-decoration: none;
224
+ font-weight: 500;
225
+ transition: all 0.2s ease;
226
  }
227
  .dataframe-container table td a:hover {
228
  color: #a3c9ff;
229
  text-decoration: underline;
230
  }
231
 
232
+ /* Column-specific styles */
233
+ .dataframe-container table td:first-child,
234
+ .dataframe-container table th:first-child {
235
+ text-align: center;
236
+ width: 80px;
237
+ }
238
+ .dataframe-container table td:last-child,
239
+ .dataframe-container table th:last-child {
240
+ text-align: center;
241
+ font-weight: 600;
242
+ }
243
+
244
  /* Enable scrollbar */
245
  #leaderboard-table .dataframe-container {
246
+ max-height: 500px !important;
247
  overflow-y: auto !important;
248
  }
249
+
250
+ /* Custom Scrollbar for WebKit browsers */
251
+ .dataframe-container::-webkit-scrollbar {
252
+ width: 8px;
253
+ }
254
+ .dataframe-container::-webkit-scrollbar-track {
255
+ background: #1a1a1a;
256
+ border-radius: 4px;
257
+ }
258
+ .dataframe-container::-webkit-scrollbar-thumb {
259
+ background: #444;
260
+ border-radius: 4px;
261
+ }
262
+ .dataframe-container::-webkit-scrollbar-thumb:hover {
263
+ background: #555;
264
+ }
265
+
266
+ /* Markdown text styling */
267
+ .markdown-text {
268
+ line-height: 1.6;
269
+ font-size: 1.05rem;
270
+ color: #d0d0d0;
271
+ }
272
+ .markdown-text h1, .markdown-text h2, .markdown-text h3 {
273
+ color: #fff;
274
+ font-weight: 600;
275
+ margin-top: 1.5rem;
276
+ margin-bottom: 1rem;
277
+ }
278
+ .markdown-text p {
279
+ margin-bottom: 1rem;
280
+ }
281
  """
282
  custom_css += dark_css
283
 
284
  # --- Override Title ---
285
  TITLE = """
286
+ <div class="hero-section">
287
+ <h1><i class="fa fa-trophy" style="color: gold;"></i> MLE-Dojo Benchmark Leaderboard</h1>
288
  <h2>Improving LLM Agents for Machine Learning Engineering</h2>
289
  </div>
290
  """
 
294
  demo = gr.Blocks(css=custom_css, theme=gr.themes.Base())
295
 
296
  with demo:
297
+ # Inject FontAwesome CSS and JS explicitly in the head
298
  gr.HTML("""
299
+ <head>
300
+ <link rel="stylesheet"
301
+ href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
302
+ integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw=="
303
+ crossorigin="anonymous" referrerpolicy="no-referrer" />
304
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/js/all.min.js"
305
+ integrity="sha512-fD9DI5bZwQxOi7MhYWnnNPlvXdp/2Pj3XSTRrFs5FQa4mizyGLnJcN6tuvUS6LbmgN1ut+XGSABKvjN0H6Aoow=="
306
+ crossorigin="anonymous" referrerpolicy="no-referrer"></script>
307
+ </head>
308
+ """)
309
 
310
  # Header & Intro
311
  gr.HTML(TITLE)
312
  gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
313
 
314
+ # Tabs - Fix icons by using Font Awesome classes correctly
315
+ with gr.Tabs(elem_classes="tab-nav-buttons") as tabs:
316
+ with gr.TabItem("📋 Leaderboard"):
317
+ gr.Markdown("## Model Elo Rankings by Category", elem_classes="markdown-text")
318
  category_selector = gr.Radio(
319
  choices=CATEGORIES,
320
  label="Select Category:",
 
338
  outputs=leaderboard_df
339
  )
340
 
341
+ with gr.TabItem("ℹ️ About"):
342
  gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
343
 
344
  # Citation Accordion
 
353
 
354
  if __name__ == "__main__":
355
  print("Launching Gradio App in Dark Mode...")
356
+ demo.launch()