Update app.py
Browse files
app.py
CHANGED
@@ -148,368 +148,92 @@ initialize_leaderboard_file()
|
|
148 |
# Function to set default mode
|
149 |
import gradio as gr
|
150 |
|
151 |
-
#
|
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 {
|
161 |
-
# display: flex;
|
162 |
-
# flex-direction: column;
|
163 |
-
# align-items: center;
|
164 |
-
# justify-content: center;
|
165 |
-
# text-align: center;
|
166 |
-
# margin: 30px 0;
|
167 |
-
# padding: 20px;
|
168 |
-
# }
|
169 |
-
|
170 |
-
# h1, h2 {
|
171 |
-
# color: #5e35b1;
|
172 |
-
# margin: 15px 0;
|
173 |
-
# text-align: center;
|
174 |
-
# }
|
175 |
-
# img {
|
176 |
-
# width: 100px;
|
177 |
-
# height: 100px;
|
178 |
-
# }
|
179 |
-
# """
|
180 |
-
|
181 |
-
# # Create the Gradio Interface
|
182 |
-
# with gr.Blocks(css=css_tech_theme) as demo:
|
183 |
-
# gr.Markdown("""
|
184 |
-
# <div class="center-content">
|
185 |
-
# <h1>π Mobile-MMLU Benchmark Competition</h1>
|
186 |
-
# <h2>π Welcome to the Competition</h2>
|
187 |
-
# <p>
|
188 |
-
# Welcome to the Mobile-MMLU Benchmark Competition. Here you can submit your predictions,
|
189 |
-
# view the leaderboard, and track your performance!
|
190 |
-
# </p>
|
191 |
-
# <hr>
|
192 |
-
# </div>
|
193 |
-
# """)
|
194 |
-
|
195 |
-
|
196 |
-
# with gr.Tabs(elem_id="tabs"):
|
197 |
-
# with gr.TabItem("π Overview"):
|
198 |
-
# gr.Markdown("""
|
199 |
-
# **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**.
|
200 |
-
# ---
|
201 |
-
# ## What is Mobile-MMLU?
|
202 |
-
# 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.
|
203 |
-
# ---
|
204 |
-
# ## How It Works
|
205 |
-
# 1. **Download the Dataset**
|
206 |
-
# Access the dataset and instructions on our [GitHub page](https://github.com/your-github-repo).
|
207 |
-
# 2. **Generate Predictions**
|
208 |
-
# Use your LLM to answer the dataset questions. Format your predictions as a CSV file.
|
209 |
-
# 3. **Submit Predictions**
|
210 |
-
# Upload your predictions on this platform.
|
211 |
-
# 4. **Evaluation**
|
212 |
-
# Submissions are scored on accuracy.
|
213 |
-
# 5. **Leaderboard**
|
214 |
-
# View real-time rankings on the leaderboard.
|
215 |
-
# ---
|
216 |
-
# """)
|
217 |
-
|
218 |
-
# with gr.TabItem("π€ Submission"):
|
219 |
-
# with gr.Row():
|
220 |
-
# file_input = gr.File(label="Upload Prediction CSV", file_types=[".csv"], interactive=True)
|
221 |
-
# model_name_input = gr.Textbox(label="Model Name", placeholder="Enter your model name")
|
222 |
-
|
223 |
-
# with gr.Row():
|
224 |
-
# overall_accuracy_display = gr.Number(label="Overall Accuracy", interactive=False)
|
225 |
-
# add_to_leaderboard_checkbox = gr.Checkbox(label="Add to Leaderboard?", value=True)
|
226 |
-
|
227 |
-
# eval_button = gr.Button("Evaluate")
|
228 |
-
# eval_status = gr.Textbox(label="Evaluation Status", interactive=False)
|
229 |
-
|
230 |
-
# def handle_evaluation(file, model_name, add_to_leaderboard):
|
231 |
-
# status, leaderboard = evaluate_predictions(file, model_name, add_to_leaderboard)
|
232 |
-
# if leaderboard.empty:
|
233 |
-
# overall_accuracy = 0
|
234 |
-
# else:
|
235 |
-
# overall_accuracy = leaderboard.iloc[-1]["Overall Accuracy"]
|
236 |
-
# return status, overall_accuracy
|
237 |
-
|
238 |
-
# eval_button.click(
|
239 |
-
# handle_evaluation,
|
240 |
-
# inputs=[file_input, model_name_input, add_to_leaderboard_checkbox],
|
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",
|
248 |
-
# interactive=False,
|
249 |
-
# wrap=True,
|
250 |
-
# )
|
251 |
-
# refresh_button = gr.Button("Refresh Leaderboard")
|
252 |
-
# refresh_button.click(
|
253 |
-
# lambda: load_leaderboard(),
|
254 |
-
# inputs=[],
|
255 |
-
# outputs=[leaderboard_table],
|
256 |
-
# )
|
257 |
-
|
258 |
-
# gr.Markdown(f"Last updated on **{LAST_UPDATED}**")
|
259 |
-
|
260 |
-
# demo.launch()
|
261 |
-
|
262 |
-
import gradio as gr
|
263 |
-
|
264 |
-
# Custom CSS to match website style
|
265 |
-
# Define CSS to match a modern, professional design
|
266 |
-
# Define enhanced CSS for the entire layout
|
267 |
css_tech_theme = """
|
268 |
body {
|
269 |
-
font-family: 'Roboto', sans-serif;
|
270 |
background-color: #f4f6fa;
|
271 |
color: #333333;
|
272 |
-
|
273 |
-
padding: 0;
|
274 |
-
}
|
275 |
-
|
276 |
-
/* Header Styling */
|
277 |
-
header {
|
278 |
-
text-align: center;
|
279 |
-
padding: 60px 20px;
|
280 |
-
background: linear-gradient(135deg, #6a1b9a, #64b5f6);
|
281 |
-
color: #ffffff;
|
282 |
-
border-radius: 12px;
|
283 |
-
margin-bottom: 30px;
|
284 |
-
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
|
285 |
-
}
|
286 |
-
|
287 |
-
header h1 {
|
288 |
-
font-size: 3.5em;
|
289 |
-
font-weight: bold;
|
290 |
-
margin-bottom: 10px;
|
291 |
-
}
|
292 |
-
|
293 |
-
header h2 {
|
294 |
-
font-size: 2em;
|
295 |
-
margin-bottom: 15px;
|
296 |
-
}
|
297 |
-
|
298 |
-
header p {
|
299 |
-
font-size: 1.2em;
|
300 |
line-height: 1.8;
|
301 |
}
|
302 |
|
303 |
-
.
|
304 |
display: flex;
|
|
|
|
|
305 |
justify-content: center;
|
306 |
-
gap: 15px;
|
307 |
-
margin-top: 20px;
|
308 |
-
}
|
309 |
-
|
310 |
-
.header-buttons a {
|
311 |
-
text-decoration: none;
|
312 |
-
font-size: 1.1em;
|
313 |
-
padding: 15px 30px;
|
314 |
-
border-radius: 30px;
|
315 |
-
font-weight: bold;
|
316 |
-
background: #ffffff;
|
317 |
-
color: #6a1b9a;
|
318 |
-
transition: transform 0.3s, background 0.3s;
|
319 |
-
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
320 |
-
}
|
321 |
-
|
322 |
-
.header-buttons a:hover {
|
323 |
-
background: #64b5f6;
|
324 |
-
color: #ffffff;
|
325 |
-
transform: scale(1.05);
|
326 |
-
}
|
327 |
-
|
328 |
-
/* Pre-Tabs Section */
|
329 |
-
.pre-tabs {
|
330 |
text-align: center;
|
331 |
-
|
332 |
-
background: linear-gradient(135deg, #ffffff, #f9fafb);
|
333 |
-
border-top: 5px solid #64b5f6;
|
334 |
-
border-bottom: 5px solid #6a1b9a;
|
335 |
-
}
|
336 |
-
|
337 |
-
.pre-tabs h2 {
|
338 |
-
font-size: 2.5em;
|
339 |
-
color: #333333;
|
340 |
-
margin-bottom: 15px;
|
341 |
-
}
|
342 |
-
|
343 |
-
.pre-tabs p {
|
344 |
-
font-size: 1.2em;
|
345 |
-
color: #555555;
|
346 |
-
line-height: 1.8;
|
347 |
-
}
|
348 |
-
|
349 |
-
/* Tabs Section */
|
350 |
-
.tabs {
|
351 |
-
margin: 0 auto;
|
352 |
padding: 20px;
|
353 |
-
background: #ffffff;
|
354 |
-
border-radius: 12px;
|
355 |
-
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
|
356 |
-
max-width: 1200px;
|
357 |
}
|
358 |
|
359 |
-
|
360 |
-
|
|
|
361 |
text-align: center;
|
362 |
-
padding: 40px 20px;
|
363 |
-
background: linear-gradient(135deg, #64b5f6, #6a1b9a);
|
364 |
-
color: #ffffff;
|
365 |
-
border-radius: 12px;
|
366 |
-
margin-top: 30px;
|
367 |
}
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
margin-bottom: 15px;
|
372 |
-
}
|
373 |
-
|
374 |
-
.post-tabs p {
|
375 |
-
font-size: 1.2em;
|
376 |
-
line-height: 1.8;
|
377 |
-
margin-bottom: 20px;
|
378 |
-
}
|
379 |
-
|
380 |
-
.post-tabs a {
|
381 |
-
text-decoration: none;
|
382 |
-
font-size: 1.1em;
|
383 |
-
padding: 15px 30px;
|
384 |
-
border-radius: 30px;
|
385 |
-
font-weight: bold;
|
386 |
-
background: #ffffff;
|
387 |
-
color: #6a1b9a;
|
388 |
-
transition: transform 0.3s, background 0.3s;
|
389 |
-
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
390 |
-
}
|
391 |
-
|
392 |
-
.post-tabs a:hover {
|
393 |
-
background: #6a1b9a;
|
394 |
-
color: #ffffff;
|
395 |
-
transform: scale(1.05);
|
396 |
-
}
|
397 |
-
|
398 |
-
/* Footer */
|
399 |
-
footer {
|
400 |
-
background: linear-gradient(135deg, #6a1b9a, #8e44ad);
|
401 |
-
color: #ffffff;
|
402 |
-
text-align: center;
|
403 |
-
padding: 40px 20px;
|
404 |
-
margin-top: 30px;
|
405 |
-
border-radius: 12px;
|
406 |
-
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
|
407 |
-
}
|
408 |
-
|
409 |
-
footer h2 {
|
410 |
-
font-size: 1.8em;
|
411 |
-
margin-bottom: 15px;
|
412 |
-
}
|
413 |
-
|
414 |
-
footer p {
|
415 |
-
font-size: 1.1em;
|
416 |
-
line-height: 1.6;
|
417 |
-
margin-bottom: 20px;
|
418 |
-
}
|
419 |
-
|
420 |
-
footer .social-links {
|
421 |
-
display: flex;
|
422 |
-
justify-content: center;
|
423 |
-
gap: 15px;
|
424 |
-
margin-top: 20px;
|
425 |
-
}
|
426 |
-
|
427 |
-
footer .social-links a {
|
428 |
-
text-decoration: none;
|
429 |
-
font-size: 1.1em;
|
430 |
-
padding: 10px 20px;
|
431 |
-
border-radius: 8px;
|
432 |
-
font-weight: bold;
|
433 |
-
background: #ffffff;
|
434 |
-
color: #6a1b9a;
|
435 |
-
transition: transform 0.3s, background 0.3s;
|
436 |
-
}
|
437 |
-
|
438 |
-
footer .social-links a:hover {
|
439 |
-
background: #64b5f6;
|
440 |
-
color: #ffffff;
|
441 |
-
transform: scale(1.1);
|
442 |
}
|
443 |
"""
|
444 |
|
445 |
-
# Gradio Interface
|
446 |
with gr.Blocks(css=css_tech_theme) as demo:
|
447 |
-
# Header Section
|
448 |
gr.Markdown("""
|
449 |
-
<
|
450 |
<h1>π Mobile-MMLU Benchmark Competition</h1>
|
451 |
-
<h2
|
452 |
<p>
|
453 |
-
|
454 |
-
|
455 |
</p>
|
456 |
-
<
|
457 |
-
|
458 |
-
<a href="#submission">Submit Predictions</a>
|
459 |
-
<a href="#leaderboard">View Leaderboard</a>
|
460 |
-
</div>
|
461 |
-
</header>
|
462 |
""")
|
463 |
|
464 |
-
# Pre-Tabs Section
|
465 |
-
gr.Markdown("""
|
466 |
-
<section class="pre-tabs">
|
467 |
-
<h2>Why Participate?</h2>
|
468 |
-
<p>
|
469 |
-
The Mobile-MMLU Benchmark Competition is a unique opportunity to test your LLMs against
|
470 |
-
real-world scenarios. Compete to drive innovation and make your mark in mobile AI.
|
471 |
-
</p>
|
472 |
-
</section>
|
473 |
-
""")
|
474 |
|
475 |
-
# Tabs Section
|
476 |
with gr.Tabs(elem_id="tabs"):
|
477 |
-
# Overview Tab
|
478 |
with gr.TabItem("π Overview"):
|
479 |
gr.Markdown("""
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
""")
|
498 |
|
499 |
-
# Submission Tab
|
500 |
with gr.TabItem("π€ Submission"):
|
501 |
-
gr.Markdown("<div class='tabs'><h2>Submit Your Predictions</h2></div>")
|
502 |
with gr.Row():
|
503 |
file_input = gr.File(label="Upload Prediction CSV", file_types=[".csv"], interactive=True)
|
504 |
model_name_input = gr.Textbox(label="Model Name", placeholder="Enter your model name")
|
|
|
505 |
with gr.Row():
|
506 |
overall_accuracy_display = gr.Number(label="Overall Accuracy", interactive=False)
|
507 |
add_to_leaderboard_checkbox = gr.Checkbox(label="Add to Leaderboard?", value=True)
|
|
|
508 |
eval_button = gr.Button("Evaluate")
|
509 |
eval_status = gr.Textbox(label="Evaluation Status", interactive=False)
|
510 |
|
511 |
def handle_evaluation(file, model_name, add_to_leaderboard):
|
512 |
-
|
|
|
|
|
|
|
|
|
|
|
513 |
|
514 |
eval_button.click(
|
515 |
handle_evaluation,
|
@@ -517,46 +241,322 @@ with gr.Blocks(css=css_tech_theme) as demo:
|
|
517 |
outputs=[eval_status, overall_accuracy_display],
|
518 |
)
|
519 |
|
520 |
-
# Leaderboard Tab
|
521 |
with gr.TabItem("π
Leaderboard"):
|
522 |
leaderboard_table = gr.Dataframe(
|
523 |
-
value=load_leaderboard(),
|
524 |
label="Leaderboard",
|
525 |
interactive=False,
|
526 |
-
wrap=True,
|
|
|
527 |
refresh_button = gr.Button("Refresh Leaderboard")
|
528 |
refresh_button.click(
|
529 |
-
load_leaderboard,
|
530 |
inputs=[],
|
531 |
outputs=[leaderboard_table],
|
532 |
)
|
533 |
|
534 |
-
|
535 |
-
gr.Markdown("""
|
536 |
-
<section class="post-tabs">
|
537 |
-
<h2>Ready to Compete?</h2>
|
538 |
-
<p>
|
539 |
-
Submit your predictions today and make your mark in advancing mobile AI technologies.
|
540 |
-
Show the world what your model can achieve!
|
541 |
-
</p>
|
542 |
-
<a href="#submission">Start Submitting</a>
|
543 |
-
</section>
|
544 |
-
""")
|
545 |
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
560 |
|
561 |
-
# Launch the interface
|
562 |
-
demo.launch()
|
|
|
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 {
|
161 |
display: flex;
|
162 |
+
flex-direction: column;
|
163 |
+
align-items: center;
|
164 |
justify-content: center;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
text-align: center;
|
166 |
+
margin: 30px 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
padding: 20px;
|
|
|
|
|
|
|
|
|
168 |
}
|
169 |
|
170 |
+
h1, h2 {
|
171 |
+
color: #5e35b1;
|
172 |
+
margin: 15px 0;
|
173 |
text-align: center;
|
|
|
|
|
|
|
|
|
|
|
174 |
}
|
175 |
+
img {
|
176 |
+
width: 100px;
|
177 |
+
height: 100px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
}
|
179 |
"""
|
180 |
|
181 |
+
# Create the Gradio Interface
|
182 |
with gr.Blocks(css=css_tech_theme) as demo:
|
|
|
183 |
gr.Markdown("""
|
184 |
+
<div class="center-content">
|
185 |
<h1>π Mobile-MMLU Benchmark Competition</h1>
|
186 |
+
<h2>π Welcome to the Competition</h2>
|
187 |
<p>
|
188 |
+
Welcome to the Mobile-MMLU Benchmark Competition. Here you can submit your predictions,
|
189 |
+
view the leaderboard, and track your performance!
|
190 |
</p>
|
191 |
+
<hr>
|
192 |
+
</div>
|
|
|
|
|
|
|
|
|
193 |
""")
|
194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
|
|
|
196 |
with gr.Tabs(elem_id="tabs"):
|
|
|
197 |
with gr.TabItem("π Overview"):
|
198 |
gr.Markdown("""
|
199 |
+
**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**.
|
200 |
+
---
|
201 |
+
## What is Mobile-MMLU?
|
202 |
+
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.
|
203 |
+
---
|
204 |
+
## How It Works
|
205 |
+
1. **Download the Dataset**
|
206 |
+
Access the dataset and instructions on our [GitHub page](https://github.com/your-github-repo).
|
207 |
+
2. **Generate Predictions**
|
208 |
+
Use your LLM to answer the dataset questions. Format your predictions as a CSV file.
|
209 |
+
3. **Submit Predictions**
|
210 |
+
Upload your predictions on this platform.
|
211 |
+
4. **Evaluation**
|
212 |
+
Submissions are scored on accuracy.
|
213 |
+
5. **Leaderboard**
|
214 |
+
View real-time rankings on the leaderboard.
|
215 |
+
---
|
216 |
""")
|
217 |
|
|
|
218 |
with gr.TabItem("π€ Submission"):
|
|
|
219 |
with gr.Row():
|
220 |
file_input = gr.File(label="Upload Prediction CSV", file_types=[".csv"], interactive=True)
|
221 |
model_name_input = gr.Textbox(label="Model Name", placeholder="Enter your model name")
|
222 |
+
|
223 |
with gr.Row():
|
224 |
overall_accuracy_display = gr.Number(label="Overall Accuracy", interactive=False)
|
225 |
add_to_leaderboard_checkbox = gr.Checkbox(label="Add to Leaderboard?", value=True)
|
226 |
+
|
227 |
eval_button = gr.Button("Evaluate")
|
228 |
eval_status = gr.Textbox(label="Evaluation Status", interactive=False)
|
229 |
|
230 |
def handle_evaluation(file, model_name, add_to_leaderboard):
|
231 |
+
status, leaderboard = evaluate_predictions(file, model_name, add_to_leaderboard)
|
232 |
+
if leaderboard.empty:
|
233 |
+
overall_accuracy = 0
|
234 |
+
else:
|
235 |
+
overall_accuracy = leaderboard.iloc[-1]["Overall Accuracy"]
|
236 |
+
return status, overall_accuracy
|
237 |
|
238 |
eval_button.click(
|
239 |
handle_evaluation,
|
|
|
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",
|
248 |
interactive=False,
|
249 |
+
wrap=True,
|
250 |
+
)
|
251 |
refresh_button = gr.Button("Refresh Leaderboard")
|
252 |
refresh_button.click(
|
253 |
+
lambda: load_leaderboard(),
|
254 |
inputs=[],
|
255 |
outputs=[leaderboard_table],
|
256 |
)
|
257 |
|
258 |
+
gr.Markdown(f"Last updated on **{LAST_UPDATED}**")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
|
260 |
+
demo.launch()
|
261 |
+
|
262 |
+
|
263 |
+
|
264 |
+
# # Custom CSS to match website style
|
265 |
+
# # Define CSS to match a modern, professional design
|
266 |
+
# # Define enhanced CSS for the entire layout
|
267 |
+
# css_tech_theme = """
|
268 |
+
# body {
|
269 |
+
# font-family: 'Roboto', sans-serif;
|
270 |
+
# background-color: #f4f6fa;
|
271 |
+
# color: #333333;
|
272 |
+
# margin: 0;
|
273 |
+
# padding: 0;
|
274 |
+
# }
|
275 |
+
|
276 |
+
# /* Header Styling */
|
277 |
+
# header {
|
278 |
+
# text-align: center;
|
279 |
+
# padding: 60px 20px;
|
280 |
+
# background: linear-gradient(135deg, #6a1b9a, #64b5f6);
|
281 |
+
# color: #ffffff;
|
282 |
+
# border-radius: 12px;
|
283 |
+
# margin-bottom: 30px;
|
284 |
+
# box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
|
285 |
+
# }
|
286 |
+
|
287 |
+
# header h1 {
|
288 |
+
# font-size: 3.5em;
|
289 |
+
# font-weight: bold;
|
290 |
+
# margin-bottom: 10px;
|
291 |
+
# }
|
292 |
+
|
293 |
+
# header h2 {
|
294 |
+
# font-size: 2em;
|
295 |
+
# margin-bottom: 15px;
|
296 |
+
# }
|
297 |
+
|
298 |
+
# header p {
|
299 |
+
# font-size: 1.2em;
|
300 |
+
# line-height: 1.8;
|
301 |
+
# }
|
302 |
+
|
303 |
+
# .header-buttons {
|
304 |
+
# display: flex;
|
305 |
+
# justify-content: center;
|
306 |
+
# gap: 15px;
|
307 |
+
# margin-top: 20px;
|
308 |
+
# }
|
309 |
+
|
310 |
+
# .header-buttons a {
|
311 |
+
# text-decoration: none;
|
312 |
+
# font-size: 1.1em;
|
313 |
+
# padding: 15px 30px;
|
314 |
+
# border-radius: 30px;
|
315 |
+
# font-weight: bold;
|
316 |
+
# background: #ffffff;
|
317 |
+
# color: #6a1b9a;
|
318 |
+
# transition: transform 0.3s, background 0.3s;
|
319 |
+
# box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
320 |
+
# }
|
321 |
+
|
322 |
+
# .header-buttons a:hover {
|
323 |
+
# background: #64b5f6;
|
324 |
+
# color: #ffffff;
|
325 |
+
# transform: scale(1.05);
|
326 |
+
# }
|
327 |
+
|
328 |
+
# /* Pre-Tabs Section */
|
329 |
+
# .pre-tabs {
|
330 |
+
# text-align: center;
|
331 |
+
# padding: 40px 20px;
|
332 |
+
# background: linear-gradient(135deg, #ffffff, #f9fafb);
|
333 |
+
# border-top: 5px solid #64b5f6;
|
334 |
+
# border-bottom: 5px solid #6a1b9a;
|
335 |
+
# }
|
336 |
+
|
337 |
+
# .pre-tabs h2 {
|
338 |
+
# font-size: 2.5em;
|
339 |
+
# color: #333333;
|
340 |
+
# margin-bottom: 15px;
|
341 |
+
# }
|
342 |
+
|
343 |
+
# .pre-tabs p {
|
344 |
+
# font-size: 1.2em;
|
345 |
+
# color: #555555;
|
346 |
+
# line-height: 1.8;
|
347 |
+
# }
|
348 |
+
|
349 |
+
# /* Tabs Section */
|
350 |
+
# .tabs {
|
351 |
+
# margin: 0 auto;
|
352 |
+
# padding: 20px;
|
353 |
+
# background: #ffffff;
|
354 |
+
# border-radius: 12px;
|
355 |
+
# box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
|
356 |
+
# max-width: 1200px;
|
357 |
+
# }
|
358 |
+
|
359 |
+
# /* Post-Tabs Section */
|
360 |
+
# .post-tabs {
|
361 |
+
# text-align: center;
|
362 |
+
# padding: 40px 20px;
|
363 |
+
# background: linear-gradient(135deg, #64b5f6, #6a1b9a);
|
364 |
+
# color: #ffffff;
|
365 |
+
# border-radius: 12px;
|
366 |
+
# margin-top: 30px;
|
367 |
+
# }
|
368 |
+
|
369 |
+
# .post-tabs h2 {
|
370 |
+
# font-size: 2.5em;
|
371 |
+
# margin-bottom: 15px;
|
372 |
+
# }
|
373 |
+
|
374 |
+
# .post-tabs p {
|
375 |
+
# font-size: 1.2em;
|
376 |
+
# line-height: 1.8;
|
377 |
+
# margin-bottom: 20px;
|
378 |
+
# }
|
379 |
+
|
380 |
+
# .post-tabs a {
|
381 |
+
# text-decoration: none;
|
382 |
+
# font-size: 1.1em;
|
383 |
+
# padding: 15px 30px;
|
384 |
+
# border-radius: 30px;
|
385 |
+
# font-weight: bold;
|
386 |
+
# background: #ffffff;
|
387 |
+
# color: #6a1b9a;
|
388 |
+
# transition: transform 0.3s, background 0.3s;
|
389 |
+
# box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
390 |
+
# }
|
391 |
+
|
392 |
+
# .post-tabs a:hover {
|
393 |
+
# background: #6a1b9a;
|
394 |
+
# color: #ffffff;
|
395 |
+
# transform: scale(1.05);
|
396 |
+
# }
|
397 |
+
|
398 |
+
# /* Footer */
|
399 |
+
# footer {
|
400 |
+
# background: linear-gradient(135deg, #6a1b9a, #8e44ad);
|
401 |
+
# color: #ffffff;
|
402 |
+
# text-align: center;
|
403 |
+
# padding: 40px 20px;
|
404 |
+
# margin-top: 30px;
|
405 |
+
# border-radius: 12px;
|
406 |
+
# box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
|
407 |
+
# }
|
408 |
+
|
409 |
+
# footer h2 {
|
410 |
+
# font-size: 1.8em;
|
411 |
+
# margin-bottom: 15px;
|
412 |
+
# }
|
413 |
+
|
414 |
+
# footer p {
|
415 |
+
# font-size: 1.1em;
|
416 |
+
# line-height: 1.6;
|
417 |
+
# margin-bottom: 20px;
|
418 |
+
# }
|
419 |
+
|
420 |
+
# footer .social-links {
|
421 |
+
# display: flex;
|
422 |
+
# justify-content: center;
|
423 |
+
# gap: 15px;
|
424 |
+
# margin-top: 20px;
|
425 |
+
# }
|
426 |
+
|
427 |
+
# footer .social-links a {
|
428 |
+
# text-decoration: none;
|
429 |
+
# font-size: 1.1em;
|
430 |
+
# padding: 10px 20px;
|
431 |
+
# border-radius: 8px;
|
432 |
+
# font-weight: bold;
|
433 |
+
# background: #ffffff;
|
434 |
+
# color: #6a1b9a;
|
435 |
+
# transition: transform 0.3s, background 0.3s;
|
436 |
+
# }
|
437 |
+
|
438 |
+
# footer .social-links a:hover {
|
439 |
+
# background: #64b5f6;
|
440 |
+
# color: #ffffff;
|
441 |
+
# transform: scale(1.1);
|
442 |
+
# }
|
443 |
+
# """
|
444 |
+
|
445 |
+
# # Gradio Interface
|
446 |
+
# with gr.Blocks(css=css_tech_theme) as demo:
|
447 |
+
# # Header Section
|
448 |
+
# gr.Markdown("""
|
449 |
+
# <header>
|
450 |
+
# <h1>π Mobile-MMLU Benchmark Competition</h1>
|
451 |
+
# <h2>π Push the Boundaries of Mobile AI</h2>
|
452 |
+
# <p>
|
453 |
+
# Test and optimize mobile-compatible Large Language Models (LLMs) with cutting-edge benchmarks
|
454 |
+
# across 80 fields and over 16,000 questions.
|
455 |
+
# </p>
|
456 |
+
# <div class="header-buttons">
|
457 |
+
# <a href="#overview">Learn More</a>
|
458 |
+
# <a href="#submission">Submit Predictions</a>
|
459 |
+
# <a href="#leaderboard">View Leaderboard</a>
|
460 |
+
# </div>
|
461 |
+
# </header>
|
462 |
+
# """)
|
463 |
+
|
464 |
+
# # Pre-Tabs Section
|
465 |
+
# gr.Markdown("""
|
466 |
+
# <section class="pre-tabs">
|
467 |
+
# <h2>Why Participate?</h2>
|
468 |
+
# <p>
|
469 |
+
# The Mobile-MMLU Benchmark Competition is a unique opportunity to test your LLMs against
|
470 |
+
# real-world scenarios. Compete to drive innovation and make your mark in mobile AI.
|
471 |
+
# </p>
|
472 |
+
# </section>
|
473 |
+
# """)
|
474 |
+
|
475 |
+
# # Tabs Section
|
476 |
+
# with gr.Tabs(elem_id="tabs"):
|
477 |
+
# # Overview Tab
|
478 |
+
# with gr.TabItem("π Overview"):
|
479 |
+
# gr.Markdown("""
|
480 |
+
# <div class="tabs">
|
481 |
+
# <h2>About the Competition</h2>
|
482 |
+
# <p>
|
483 |
+
# The **Mobile-MMLU Benchmark Competition** is an exciting challenge for mobile-optimized
|
484 |
+
# LLMs. Compete to achieve the highest accuracy and contribute to advancements in mobile AI.
|
485 |
+
# </p>
|
486 |
+
# <h3>How It Works</h3>
|
487 |
+
# <ul>
|
488 |
+
# <li>1οΈβ£ <strong>Download the Dataset:</strong> Access the dataset and instructions on our
|
489 |
+
# <a href="https://github.com/your-github-repo" target="_blank">GitHub page</a>.</li>
|
490 |
+
# <li>2οΈβ£ <strong>Generate Predictions:</strong> Use your LLM to answer the dataset questions.
|
491 |
+
# Format your predictions as a CSV file.</li>
|
492 |
+
# <li>3οΈβ£ <strong>Submit Predictions:</strong> Upload your predictions on this platform.</li>
|
493 |
+
# <li>4οΈβ£ <strong>Evaluation:</strong> Submissions are scored based on accuracy.</li>
|
494 |
+
# <li>5οΈβ£ <strong>Leaderboard:</strong> View real-time rankings on the leaderboard.</li>
|
495 |
+
# </ul>
|
496 |
+
# </div>
|
497 |
+
# """)
|
498 |
+
|
499 |
+
# # Submission Tab
|
500 |
+
# with gr.TabItem("π€ Submission"):
|
501 |
+
# gr.Markdown("<div class='tabs'><h2>Submit Your Predictions</h2></div>")
|
502 |
+
# with gr.Row():
|
503 |
+
# file_input = gr.File(label="Upload Prediction CSV", file_types=[".csv"], interactive=True)
|
504 |
+
# model_name_input = gr.Textbox(label="Model Name", placeholder="Enter your model name")
|
505 |
+
# with gr.Row():
|
506 |
+
# overall_accuracy_display = gr.Number(label="Overall Accuracy", interactive=False)
|
507 |
+
# add_to_leaderboard_checkbox = gr.Checkbox(label="Add to Leaderboard?", value=True)
|
508 |
+
# eval_button = gr.Button("Evaluate")
|
509 |
+
# eval_status = gr.Textbox(label="Evaluation Status", interactive=False)
|
510 |
+
|
511 |
+
# def handle_evaluation(file, model_name, add_to_leaderboard):
|
512 |
+
# return "Evaluation complete. Model added to leaderboard.", 85.0
|
513 |
+
|
514 |
+
# eval_button.click(
|
515 |
+
# handle_evaluation,
|
516 |
+
# inputs=[file_input, model_name_input, add_to_leaderboard_checkbox],
|
517 |
+
# outputs=[eval_status, overall_accuracy_display],
|
518 |
+
# )
|
519 |
+
|
520 |
+
# # Leaderboard Tab
|
521 |
+
# with gr.TabItem("π
Leaderboard"):
|
522 |
+
# leaderboard_table = gr.Dataframe(
|
523 |
+
# value=load_leaderboard(), # Initial data
|
524 |
+
# label="Leaderboard",
|
525 |
+
# interactive=False,
|
526 |
+
# wrap=True,)
|
527 |
+
# refresh_button = gr.Button("Refresh Leaderboard")
|
528 |
+
# refresh_button.click(
|
529 |
+
# load_leaderboard, # Fetch latest data
|
530 |
+
# inputs=[],
|
531 |
+
# outputs=[leaderboard_table],
|
532 |
+
# )
|
533 |
+
|
534 |
+
# # Post-Tabs Section
|
535 |
+
# gr.Markdown("""
|
536 |
+
# <section class="post-tabs">
|
537 |
+
# <h2>Ready to Compete?</h2>
|
538 |
+
# <p>
|
539 |
+
# Submit your predictions today and make your mark in advancing mobile AI technologies.
|
540 |
+
# Show the world what your model can achieve!
|
541 |
+
# </p>
|
542 |
+
# <a href="#submission">Start Submitting</a>
|
543 |
+
# </section>
|
544 |
+
# """)
|
545 |
+
|
546 |
+
# # Footer Section
|
547 |
+
# gr.Markdown("""
|
548 |
+
# <footer>
|
549 |
+
# <h2>Stay Connected</h2>
|
550 |
+
# <p>
|
551 |
+
# Follow us on social media or contact us for any queries. Let's shape the future of AI together!
|
552 |
+
# </p>
|
553 |
+
# <div class="social-links">
|
554 |
+
# <a href="https://twitter.com" target="_blank">Twitter</a>
|
555 |
+
# <a href="https://linkedin.com" target="_blank">LinkedIn</a>
|
556 |
+
# <a href="https://github.com" target="_blank">GitHub</a>
|
557 |
+
# </div>
|
558 |
+
# </footer>
|
559 |
+
# """)
|
560 |
|
561 |
+
# # Launch the interface
|
562 |
+
# demo.launch()
|