SondosMB commited on
Commit
5376412
Β·
verified Β·
1 Parent(s): cda6947

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +73 -28
app.py CHANGED
@@ -442,48 +442,74 @@ footer .social-links a:hover {
442
  }
443
  """
444
 
445
- # Create the Gradio Interface
446
  with gr.Blocks(css=css_tech_theme) as demo:
 
447
  gr.Markdown("""
448
- <div class="center-content">
449
  <h1>πŸ† Mobile-MMLU Benchmark Competition</h1>
450
- <h2>🌟 Welcome to the Competition</h2>
451
  <p>
452
- Welcome to the Mobile-MMLU Benchmark Competition. Submit your predictions,
453
- view the leaderboard, and track your performance!
454
  </p>
455
- <hr>
456
- </div>
 
 
 
 
457
  """)
458
 
 
 
 
 
 
 
 
 
 
 
 
 
459
  with gr.Tabs(elem_id="tabs"):
 
460
  with gr.TabItem("πŸ“– Overview"):
461
  gr.Markdown("""
462
- <div class="tab-content active">
463
  <h2>About the Competition</h2>
464
  <p>
465
- **Mobile-MMLU** evaluates mobile-optimized LLMs on 16,186 scenario-based and factual questions across 80 fields.
466
- <br><br> Test your model, submit predictions, and climb the leaderboard!
467
  </p>
 
 
 
 
 
 
 
 
 
 
468
  </div>
469
  """)
470
 
 
471
  with gr.TabItem("πŸ“€ Submission"):
 
472
  with gr.Row():
473
  file_input = gr.File(label="Upload Prediction CSV", file_types=[".csv"], interactive=True)
474
  model_name_input = gr.Textbox(label="Model Name", placeholder="Enter your model name")
475
-
476
  with gr.Row():
477
  overall_accuracy_display = gr.Number(label="Overall Accuracy", interactive=False)
478
  add_to_leaderboard_checkbox = gr.Checkbox(label="Add to Leaderboard?", value=True)
479
-
480
  eval_button = gr.Button("Evaluate")
481
  eval_status = gr.Textbox(label="Evaluation Status", interactive=False)
482
 
483
  def handle_evaluation(file, model_name, add_to_leaderboard):
484
- status, leaderboard = evaluate_predictions(file, model_name, add_to_leaderboard)
485
- overall_accuracy = leaderboard.iloc[-1]["Overall Accuracy"] if not leaderboard.empty else 0
486
- return status, overall_accuracy
487
 
488
  eval_button.click(
489
  handle_evaluation,
@@ -491,20 +517,39 @@ with gr.Blocks(css=css_tech_theme) as demo:
491
  outputs=[eval_status, overall_accuracy_display],
492
  )
493
 
 
494
  with gr.TabItem("πŸ… Leaderboard"):
495
- leaderboard_table = gr.Dataframe(
496
- value=load_leaderboard(),
497
- label="Leaderboard",
498
- interactive=False,
499
- wrap=True,
500
- )
501
  refresh_button = gr.Button("Refresh Leaderboard")
502
- refresh_button.click(
503
- lambda: load_leaderboard(),
504
- inputs=[],
505
- outputs=[leaderboard_table],
506
- )
507
 
508
- gr.Markdown("<footer>Mobile-MMLU Competition | Last Updated: December 2024</footer>")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
509
 
510
- demo.launch()
 
 
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,
 
517
  outputs=[eval_status, overall_accuracy_display],
518
  )
519
 
520
+ # Leaderboard Tab
521
  with gr.TabItem("πŸ… Leaderboard"):
522
+ gr.Markdown("<div class='tabs'><h2>Current Leaderboard</h2></div>")
523
+ leaderboard_table = gr.Dataframe(value=[], label="Leaderboard", interactive=False, wrap=True)
 
 
 
 
524
  refresh_button = gr.Button("Refresh Leaderboard")
525
+ refresh_button.click(lambda: [], inputs=[], outputs=[leaderboard_table])
 
 
 
 
526
 
527
+ # Post-Tabs Section
528
+ gr.Markdown("""
529
+ <section class="post-tabs">
530
+ <h2>Ready to Compete?</h2>
531
+ <p>
532
+ Submit your predictions today and make your mark in advancing mobile AI technologies.
533
+ Show the world what your model can achieve!
534
+ </p>
535
+ <a href="#submission">Start Submitting</a>
536
+ </section>
537
+ """)
538
+
539
+ # Footer Section
540
+ gr.Markdown("""
541
+ <footer>
542
+ <h2>Stay Connected</h2>
543
+ <p>
544
+ Follow us on social media or contact us for any queries. Let's shape the future of AI together!
545
+ </p>
546
+ <div class="social-links">
547
+ <a href="https://twitter.com" target="_blank">Twitter</a>
548
+ <a href="https://linkedin.com" target="_blank">LinkedIn</a>
549
+ <a href="https://github.com" target="_blank">GitHub</a>
550
+ </div>
551
+ </footer>
552
+ """)
553
 
554
+ # Launch the interface
555
+ demo.launch()