Jerrycool commited on
Commit
4a71421
·
verified ·
1 Parent(s): 7153753

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +58 -38
app.py CHANGED
@@ -63,33 +63,31 @@ def update_leaderboard(category):
63
  df.rename(columns={col:'Elo Score','organizer':'Organizer','license':'License'}, inplace=True)
64
  return df[['Rank','Model','Organizer','License','Elo Score']]
65
 
66
- # --- Advanced Styling ---
67
- # Base font-size bump (if any)
68
  font_size_css = """
69
  body { font-size: 1em !important; }
70
  """
71
  custom_css += font_size_css
72
 
73
- # Import fonts & icons + component styling
74
- advanced_css = """
75
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
76
  @import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');
77
 
78
  body {
79
  font-family: 'Inter', sans-serif;
80
- background-color: #f8f9fa;
81
- color: #333;
82
  }
83
 
84
  /* Hero Section */
85
  .hero-section {
86
- background: linear-gradient(135deg, #6c63ff, #8f94fb);
87
- color: #fff;
88
  padding: 2rem 1rem;
89
  border-radius: .75rem;
90
  margin-bottom: 1.5rem;
91
  text-align: center;
92
- box-shadow: 0 4px 10px rgba(0,0,0,0.1);
93
  }
94
  .hero-section h1 {
95
  margin: 0;
@@ -100,7 +98,7 @@ body {
100
  margin: .5rem 0 0 !important;
101
  font-size: 1.25rem !important;
102
  font-weight: 400 !important;
103
- opacity: 0.9;
104
  }
105
 
106
  /* Tab Buttons */
@@ -108,17 +106,17 @@ body {
108
  border-radius: 20px !important;
109
  padding: 0.5rem 1rem !important;
110
  margin-right: 0.5rem !important;
111
- background: #e0e0e0 !important;
112
- color: #333 !important;
113
  border: none !important;
114
  transition: background 0.3s !important;
115
  font-weight: 500 !important;
116
  }
117
  .tab-buttons button:hover {
118
- background: #d0d0d0 !important;
119
  }
120
  .tab-buttons button[aria-selected="true"] {
121
- background: #6c63ff !important;
122
  color: #fff !important;
123
  }
124
 
@@ -129,60 +127,84 @@ body {
129
  padding: 0.5rem 1rem;
130
  margin-right: 0.5rem;
131
  border-radius: 999px;
132
- background: #e0e0e0;
133
  cursor: pointer;
134
  transition: background 0.3s, color 0.3s;
135
  font-weight: 500;
 
136
  }
137
  #category-selector input[type="radio"]:checked + label {
138
- background: #6c63ff;
139
  color: #fff;
140
  }
141
 
142
  /* Table Styling */
143
- table {
144
  width: 100%;
145
  border: none;
146
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
147
  border-radius: 0.5rem;
148
  overflow: hidden;
149
- margin: 1rem 0;
150
  }
151
- th {
152
- background: #6c63ff;
153
- color: #fff;
 
 
 
 
 
 
154
  }
155
- td, th {
156
  padding: 0.75rem 1rem;
 
157
  }
158
- tr:nth-child(even) { background: #f7f5ff; }
159
- tr:hover { background: #edeaff; }
160
- td a {
161
- color: #6c63ff;
162
  text-decoration: none;
163
  }
164
- td a:hover {
165
- color: #534bbe;
166
  text-decoration: underline;
167
  }
 
 
 
 
 
 
168
  """
169
- custom_css += advanced_css
170
 
171
  # --- Override Title ---
172
  TITLE = """
173
- <div class="hero-section">
174
- <h1><i class="fas fa-trophy"></i> MLE-Dojo Benchmark Leaderboard</h1>
175
  <h2>Improving LLM Agents for Machine Learning Engineering</h2>
176
  </div>
177
  """
178
 
179
  # --- Build App ---
180
- demo = gr.Blocks(css=custom_css, theme=gr.themes.Soft())
 
181
 
182
  with demo:
 
 
 
 
 
 
 
 
 
 
 
183
  gr.HTML(TITLE)
184
  gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
185
 
 
186
  with gr.Tabs(elem_classes="tab-buttons") as tabs:
187
  with gr.TabItem("<i class='fas fa-list'></i> Leaderboard"):
188
  gr.Markdown("## Model Elo Rankings by Category")
@@ -212,6 +234,7 @@ with demo:
212
  with gr.TabItem("<i class='fas fa-info-circle'></i> About"):
213
  gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
214
 
 
215
  with gr.Accordion("📙 Citation", open=False):
216
  gr.Textbox(
217
  value=CITATION_BUTTON_TEXT,
@@ -222,8 +245,5 @@ with demo:
222
  )
223
 
224
  if __name__ == "__main__":
225
- print("Launching Gradio App...")
226
- try:
227
- demo.launch()
228
- except Exception as e:
229
- print(f"Error launching app: {e}")
 
63
  df.rename(columns={col:'Elo Score','organizer':'Organizer','license':'License'}, inplace=True)
64
  return df[['Rank','Model','Organizer','License','Elo Score']]
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;
78
+ background-color: #121212;
79
+ color: #e0e0e0;
80
  }
81
 
82
  /* Hero Section */
83
  .hero-section {
84
+ background: linear-gradient(135deg, #333, #222);
85
+ color: #e0e0e0;
86
  padding: 2rem 1rem;
87
  border-radius: .75rem;
88
  margin-bottom: 1.5rem;
89
  text-align: center;
90
+ box-shadow: 0 4px 10px rgba(0,0,0,0.5);
91
  }
92
  .hero-section h1 {
93
  margin: 0;
 
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 */
 
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
 
 
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
  """
187
 
188
  # --- Build App ---
189
+ # Use Dark theme for Gradio
190
+ demo = gr.Blocks(css=custom_css, theme=gr.themes.Dark())
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")
 
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
238
  with gr.Accordion("📙 Citation", open=False):
239
  gr.Textbox(
240
  value=CITATION_BUTTON_TEXT,
 
245
  )
246
 
247
  if __name__ == "__main__":
248
+ print("Launching Gradio App in Dark Mode...")
249
+ demo.launch()