SondosMB commited on
Commit
e359f0e
Β·
verified Β·
1 Parent(s): fa8abad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -153
app.py CHANGED
@@ -146,106 +146,15 @@ initialize_leaderboard_file()
146
 
147
  # Function to set default mode
148
  # Function to set default mode
 
 
 
149
  css_tech_theme = """
150
  body {
151
  background-color: #f4f6fa;
152
  color: #333333;
153
  font-family: 'Roboto', sans-serif;
154
  line-height: 1.8;
155
- margin: 0;
156
- padding: 0;
157
- }
158
-
159
- a {
160
- color: #6a1b9a;
161
- font-weight: 500;
162
- }
163
-
164
- a:hover {
165
- color: #8c52d3;
166
- text-decoration: underline;
167
- }
168
-
169
- h1, h2, h3 {
170
- color: #4a148c;
171
- margin: 15px 0;
172
- text-align: center;
173
- }
174
-
175
- h1 {
176
- font-size: 2.5rem;
177
- }
178
-
179
- h2 {
180
- font-size: 2rem;
181
- }
182
-
183
- h3 {
184
- font-size: 1.8rem;
185
- }
186
-
187
- p, li {
188
- font-size: 1.2rem;
189
- margin: 10px 0;
190
- }
191
-
192
- button {
193
- background-color: #64b5f6;
194
- color: #ffffff;
195
- border: none;
196
- border-radius: 6px;
197
- padding: 12px 18px;
198
- font-size: 16px;
199
- font-weight: bold;
200
- cursor: pointer;
201
- transition: background-color 0.3s ease;
202
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
203
- }
204
-
205
- button:hover {
206
- background-color: #6a1b9a;
207
- }
208
-
209
- .input-row, .tab-content {
210
- background-color: #ffffff;
211
- border-radius: 10px;
212
- padding: 25px;
213
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
214
- margin: 15px 0;
215
- }
216
-
217
- .tabs {
218
- margin-bottom: 20px;
219
- gap: 15px;
220
- display: flex;
221
- justify-content: center;
222
- }
223
-
224
- .tab-item {
225
- background-color: #ece2f4;
226
- border-radius: 8px;
227
- padding: 12px 20px;
228
- font-size: 1.1rem;
229
- font-weight: bold;
230
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
231
- margin: 8px;
232
- text-align: center;
233
- transition: background-color 0.3s ease;
234
- }
235
-
236
- .tab-item:hover {
237
- background-color: #d1c4e9;
238
- }
239
-
240
- .dataframe {
241
- color: #333333;
242
- background-color: #ffffff;
243
- border: 1px solid #e5eff2;
244
- border-radius: 10px;
245
- padding: 20px;
246
- font-size: 1rem;
247
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
248
- margin: 15px 0;
249
  }
250
 
251
  .center-content {
@@ -258,75 +167,63 @@ button:hover {
258
  padding: 20px;
259
  }
260
 
261
- .center-content img {
262
- max-width: 200px;
263
- height: auto;
264
- margin: 20px 0;
265
- border-radius: 10px;
266
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
267
- }
268
-
269
- hr {
270
- border: 1px solid #ddd;
271
- width: 80%;
272
- margin: 30px auto;
273
  }
274
  """
275
 
 
 
 
 
276
 
 
 
 
277
 
278
- with gr.Blocks(css=css_tech_theme) as demo:
279
- gr.Markdown("""
280
- <div class="center-content">
281
- <h1>πŸ† Mobile-MMLU Benchmark Competition</h1>
282
- <h3>🌟 Welcome to the Competition Overview</h3>
283
- <img src="https://via.placeholder.com/200" alt="Competition Logo">
284
- <p>
285
- Welcome to the Mobile-MMLU Benchmark Competition. Here you can submit your predictions,
286
- view the leaderboard, and track your performance!
287
- </p>
288
- <hr>
289
- </div>
290
- """, elem_id="center-content")
291
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
 
293
  with gr.Tabs(elem_id="tabs"):
294
- with gr.TabItem("πŸ“– Overview", elem_classes=["tab-item"]):
295
  gr.Markdown("""
296
- ## Overview
297
- Welcome to the **Mobile-MMLU Benchmark Competition**! Evaluate mobile-compatible Large Language Models (LLMs) on **16,186 scenario-based and factual questions** across **80 fields**.
298
- ---
299
- ### What is Mobile-MMLU?
300
- Mobile-MMLU is a benchmark designed to test the capabilities of LLMs optimized for mobile use. Contribute to advancing mobile AI systems by competing to achieve the highest accuracy.
301
-
302
- ### How It Works
303
- 1. **Download the Dataset**
304
- Access the dataset and instructions on our [GitHub page](https://github.com/your-github-repo).
305
- 2. **Generate Predictions**
306
- Use your LLM to answer the dataset questions. Format your predictions as a CSV file.
307
- 3. **Submit Predictions**
308
- Upload your predictions on this platform.
309
- 4. **Evaluation**
310
- Submissions are scored on accuracy.
311
- 5. **Leaderboard**
312
- View real-time rankings on the leaderboard.
313
- ---
314
- ### Competition Tasks
315
- Participants must:
316
- - Optimize their models for **accuracy**.
317
- - Answer diverse field questions effectively.
318
- ---
319
- ### Get Started
320
- 1. Prepare your model using resources on our [GitHub page](https://github.com/your-github-repo).
321
- 2. Submit predictions in the required format.
322
- 3. Track your progress on the leaderboard.
323
-
324
- ### Contact Us
325
- For support, email: [Insert Email Address]
326
- ---
327
  """)
328
 
329
- with gr.TabItem("πŸ“€ Submission", elem_classes=["tab-item"]):
330
  with gr.Row():
331
  file_input = gr.File(label="πŸ“‚ Upload Prediction CSV", file_types=[".csv"], interactive=True)
332
  model_name_input = gr.Textbox(label="πŸ–‹οΈ Model Name", placeholder="Enter your model name")
@@ -344,7 +241,7 @@ For support, email: [Insert Email Address]
344
  outputs=[eval_status, overall_accuracy_display],
345
  )
346
 
347
- with gr.TabItem("πŸ… Leaderboard", elem_classes=["tab-item"]):
348
  leaderboard_table = gr.Dataframe(
349
  value=load_leaderboard(),
350
  label="Leaderboard",
 
146
 
147
  # Function to set default mode
148
  # Function to set default mode
149
+ import gradio as gr
150
+
151
+ # Ensure CSS is correctly defined
152
  css_tech_theme = """
153
  body {
154
  background-color: #f4f6fa;
155
  color: #333333;
156
  font-family: 'Roboto', sans-serif;
157
  line-height: 1.8;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  }
159
 
160
  .center-content {
 
167
  padding: 20px;
168
  }
169
 
170
+ h1, h3 {
171
+ color: #5e35b1;
172
+ margin: 15px 0;
173
+ text-align: center;
 
 
 
 
 
 
 
 
174
  }
175
  """
176
 
177
+ # Ensure all required functions and variables are defined
178
+ def evaluate_predictions(file, model_name, add_to_leaderboard):
179
+ # Add logic for evaluating predictions
180
+ return "Evaluation completed", 90.0 # Example return
181
 
182
+ def load_leaderboard():
183
+ # Add logic for loading leaderboard
184
+ return [{"Model Name": "Example", "Accuracy": 90}]
185
 
186
+ LAST_UPDATED = "December 21, 2024"
 
 
 
 
 
 
 
 
 
 
 
 
187
 
188
+ # Create the Gradio Interface
189
+ with gr.Blocks(css=css_tech_theme) as demo:
190
+ gr.Markdown("""
191
+ <div class="center-content">
192
+ <h1>πŸ† Mobile-MMLU Benchmark Competition</h1>
193
+ <h3>🌟 Welcome to the Competition Overview</h3>
194
+ <img src="https://via.placeholder.com/200" alt="Competition Logo">
195
+ <p>
196
+ Welcome to the Mobile-MMLU Benchmark Competition. Here you can submit your predictions,
197
+ view the leaderboard, and track your performance!
198
+ </p>
199
+ <hr>
200
+ </div>
201
+ """)
202
 
203
  with gr.Tabs(elem_id="tabs"):
204
+ with gr.TabItem("πŸ“– Overview"):
205
  gr.Markdown("""
206
+ ## Overview
207
+ Welcome to the **Mobile-MMLU Benchmark Competition**! Evaluate mobile-compatible Large Language Models (LLMs) on **16,186 scenario-based and factual questions** across **80 fields**.
208
+ ---
209
+ ### What is Mobile-MMLU?
210
+ Mobile-MMLU is a benchmark designed to test the capabilities of LLMs optimized for mobile use. Contribute to advancing mobile AI systems by competing to achieve the highest accuracy.
211
+ ---
212
+ ### How It Works
213
+ 1. **Download the Dataset**
214
+ Access the dataset and instructions on our [GitHub page](https://github.com/your-github-repo).
215
+ 2. **Generate Predictions**
216
+ Use your LLM to answer the dataset questions. Format your predictions as a CSV file.
217
+ 3. **Submit Predictions**
218
+ Upload your predictions on this platform.
219
+ 4. **Evaluation**
220
+ Submissions are scored on accuracy.
221
+ 5. **Leaderboard**
222
+ View real-time rankings on the leaderboard.
223
+ ---
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  """)
225
 
226
+ with gr.TabItem("πŸ“€ Submission"):
227
  with gr.Row():
228
  file_input = gr.File(label="πŸ“‚ Upload Prediction CSV", file_types=[".csv"], interactive=True)
229
  model_name_input = gr.Textbox(label="πŸ–‹οΈ Model Name", placeholder="Enter your model name")
 
241
  outputs=[eval_status, overall_accuracy_display],
242
  )
243
 
244
+ with gr.TabItem("πŸ… Leaderboard"):
245
  leaderboard_table = gr.Dataframe(
246
  value=load_leaderboard(),
247
  label="Leaderboard",