aimodelshare 0.3.94__py3-none-any.whl → 0.4.71__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2480,7 +2480,6 @@ def build_final_conclusion_html(best_score, submissions, rank, first_score, feat
2480
2480
 
2481
2481
  def build_conclusion_from_state(best_score, submissions, rank, first_score, feature_set):
2482
2482
  return build_final_conclusion_html(best_score, submissions, rank, first_score, feature_set)
2483
-
2484
2483
  def create_model_building_game_en_app(theme_primary_hue: str = "indigo") -> "gr.Blocks":
2485
2484
  """
2486
2485
  Create (but do not launch) the model building game app.
@@ -3303,6 +3302,148 @@ def create_model_building_game_en_app(theme_primary_hue: str = "indigo") -> "gr.
3303
3302
  color: color-mix(in srgb, var(--color-accent) 75%, var(--body-text-color) 25%);
3304
3303
  }
3305
3304
  }
3305
+ /* ---------- NEW: Countdown & Interactive Slide Styles ---------- */
3306
+
3307
+ /* 1. Launch Banner (Slide 1) */
3308
+ .launch-banner {
3309
+ background: #111827;
3310
+ color: #4ade80;
3311
+ font-family: monospace;
3312
+ text-align: center;
3313
+ padding: 8px;
3314
+ font-size: 0.9rem;
3315
+ letter-spacing: 2px;
3316
+ margin: -24px -24px 24px -24px; /* Stretch to edges of panel */
3317
+ border-bottom: 2px solid #4ade80;
3318
+ border-radius: var(--slide-radius-lg) var(--slide-radius-lg) 0 0;
3319
+ }
3320
+
3321
+ /* 2. T-Minus Headers */
3322
+ .t-minus-header {
3323
+ text-align: center;
3324
+ margin-bottom: 24px;
3325
+ border-bottom: 2px solid var(--card-border-subtle);
3326
+ padding-bottom: 16px;
3327
+ }
3328
+
3329
+ .t-minus-badge {
3330
+ display: inline-block;
3331
+ background: var(--text-main);
3332
+ color: var(--body-background-fill);
3333
+ padding: 6px 16px;
3334
+ border-radius: 20px;
3335
+ font-weight: 800;
3336
+ font-size: 1rem;
3337
+ text-transform: uppercase;
3338
+ letter-spacing: 2px;
3339
+ margin-bottom: 8px;
3340
+ }
3341
+
3342
+ .t-minus-title {
3343
+ margin: 0;
3344
+ font-size: 2.2rem;
3345
+ color: var(--accent-strong);
3346
+ font-weight: 800;
3347
+ }
3348
+
3349
+ /* 3. Styled Details/Summary (Click-to-reveal) */
3350
+ details.styled-details {
3351
+ margin-bottom: 12px;
3352
+ background: var(--block-background-fill);
3353
+ border-radius: 10px;
3354
+ border: 1px solid var(--card-border-subtle);
3355
+ overflow: hidden;
3356
+ }
3357
+
3358
+ details.styled-details > summary {
3359
+ list-style: none;
3360
+ cursor: pointer;
3361
+ padding: 16px;
3362
+ font-weight: 700;
3363
+ display: flex;
3364
+ align-items: center;
3365
+ justify-content: space-between;
3366
+ background: var(--prose-background-fill);
3367
+ transition: background 0.2s;
3368
+ color: var(--text-main);
3369
+ }
3370
+
3371
+ details.styled-details > summary:hover {
3372
+ background: var(--block-background-fill);
3373
+ color: var(--accent-strong);
3374
+ }
3375
+
3376
+ /* Hide default triangle */
3377
+ details.styled-details > summary::-webkit-details-marker {
3378
+ display: none;
3379
+ }
3380
+
3381
+ /* Custom +/- indicator */
3382
+ details.styled-details > summary::after {
3383
+ content: '+';
3384
+ font-size: 1.5rem;
3385
+ font-weight: 400;
3386
+ color: var(--text-muted);
3387
+ }
3388
+
3389
+ details.styled-details[open] > summary::after {
3390
+ content: '−';
3391
+ color: var(--accent-strong);
3392
+ }
3393
+
3394
+ details.styled-details > div.content {
3395
+ padding: 16px;
3396
+ border-top: 1px solid var(--card-border-subtle);
3397
+ background: var(--block-background-fill);
3398
+ color: var(--text-main);
3399
+ }
3400
+
3401
+ /* 4. Mock UI Widgets (for Slide 4) */
3402
+ .widget-row { display: flex; align-items: center; margin-bottom: 8px; color: var(--text-main); font-size: 1rem; }
3403
+
3404
+ .radio-circle {
3405
+ width: 16px; height: 16px; border-radius: 50%;
3406
+ border: 2px solid var(--text-muted); margin-right: 10px; display: inline-block;
3407
+ }
3408
+ .radio-circle.selected {
3409
+ border-color: var(--accent-strong);
3410
+ background: radial-gradient(circle, var(--accent-strong) 40%, transparent 50%);
3411
+ }
3412
+
3413
+ .check-square {
3414
+ width: 16px; height: 16px; border-radius: 4px;
3415
+ border: 2px solid var(--text-muted); margin-right: 10px; display: inline-block;
3416
+ }
3417
+ .check-square.checked {
3418
+ background: var(--accent-strong); border-color: var(--accent-strong); position: relative;
3419
+ }
3420
+
3421
+ .slider-track {
3422
+ height: 6px; background: var(--border-color-primary); border-radius: 3px;
3423
+ width: 100%; position: relative; margin: 12px 0;
3424
+ }
3425
+ .slider-thumb {
3426
+ width: 18px; height: 18px; background: var(--accent-strong);
3427
+ border-radius: 50%; position: absolute; left: 20%; top: -6px;
3428
+ box-shadow: 0 1px 3px rgba(0,0,0,0.3);
3429
+ }
3430
+
3431
+ .risk-tag {
3432
+ background: #fef2f2; color: #ef4444; border: 1px solid #fecaca;
3433
+ font-size: 0.75rem; padding: 2px 8px; border-radius: 4px;
3434
+ margin-left: 8px; vertical-align: middle; font-weight: 700;
3435
+ }
3436
+
3437
+ /* Pop-up info box inside details */
3438
+ .info-popup {
3439
+ background: color-mix(in srgb, var(--color-accent) 5%, transparent);
3440
+ border-left: 4px solid var(--color-accent);
3441
+ padding: 12px;
3442
+ margin-top: 12px;
3443
+ border-radius: 4px;
3444
+ font-size: 0.95rem;
3445
+ color: var(--text-main);
3446
+ }
3306
3447
  """
3307
3448
 
3308
3449
 
@@ -3316,69 +3457,6 @@ def create_model_building_game_en_app(theme_primary_hue: str = "indigo") -> "gr.
3316
3457
  global login_username, login_password, login_submit, login_error
3317
3458
  global attempts_tracker_display, team_name_state
3318
3459
 
3319
- # --- ONBOARDING INSTRUCTION BLOCKS ---
3320
- # These contain the exact text from your original Slides 5, 6, and 7.
3321
-
3322
- # --- JIT ONBOARDING INSTRUCTIONS ---
3323
- html_step_1_brain = """
3324
- <div class='mock-ui-box' style='margin-bottom: 12px; border-left: 6px solid #4f46e5;'>
3325
- <h3 style='margin-top:0; color: #4f46e5;'>🎛️ Knob 1: Model Strategy (The "Brain")</h3>
3326
- <p>The <strong>Model Strategy</strong> uses a specific mathematical method to find patterns.</p>
3327
- <ul style='margin-bottom:0; padding-left: 20px; font-size: 0.95rem;'>
3328
- <li><strong>The Balanced Generalist:</strong> Learns broad patterns. Consistent and reliable.</li>
3329
- <li><strong>The Rule-Maker:</strong> Creates simple "If/Then" rules. Rigid but easy to understand.</li>
3330
- <li><strong>The Nearest Neighbor:</strong> Looks at history. "This case looks like Person A, so predict the same outcome."</li>
3331
- </ul>
3332
- </div>
3333
- """
3334
-
3335
- html_step_2_complexity = """
3336
- <div class='mock-ui-box' style='margin-bottom: 12px; border-left: 6px solid #0ea5e9;'>
3337
- <h3 style='margin-top:0; color: #0ea5e9;'>🎛️ Knob 2: Complexity (Fitting Level)</h3>
3338
- <p>This controls how much detail the model memorizes.</p>
3339
- <ul style='margin-bottom:0; padding-left: 20px; font-size: 0.95rem;'>
3340
- <li><strong>Low (1-3):</strong> Focuses on big, obvious rules.</li>
3341
- <li><strong>High (8-10):</strong> Memorizes tiny details.</li>
3342
- </ul>
3343
- <div style='background: #fef2f2; border: 1px solid #fecaca; padding: 8px; border-radius: 6px; margin-top: 8px;'>
3344
- <p style='color:#b91c1c; font-weight:bold; margin:0; font-size:0.9em;'>
3345
- ⚠️ Warning: Setting this too high can cause "Overfitting" (memorizing noise).
3346
- </p>
3347
- </div>
3348
- </div>
3349
- """
3350
-
3351
- html_step_3_ingredients = """
3352
- <div class='mock-ui-box' style='margin-bottom: 12px; border-left: 6px solid #8b5cf6;'>
3353
- <h3 style='margin-top:0; color: #8b5cf6;'>🧪 Knob 3: Data Ingredients</h3>
3354
- <p><strong>"Garbage in, garbage out."</strong> You decide what the AI sees.</p>
3355
- <ul style='margin-bottom:0; padding-left: 20px; font-size: 0.95rem;'>
3356
- <li><strong>Behavioral:</strong> Factual history (e.g., <em>Prior Crimes</em>).</li>
3357
- <li><strong>Demographic:</strong> Traits like <em>Race</em> or <em>Age</em>. Can introduce bias.</li>
3358
- </ul>
3359
- </div>
3360
- """
3361
-
3362
- html_step_4_size = """
3363
- <div class='mock-ui-box' style='margin-bottom: 12px; border-left: 6px solid #10b981;'>
3364
- <h3 style='margin-top:0; color: #10b981;'>📊 Knob 4: Data Size</h3>
3365
- <p><strong>Small (20%):</strong> Fast. Great for testing.<br>
3366
- <strong>Full (100%):</strong> Slower, but most accurate.</p>
3367
- </div>
3368
- """
3369
-
3370
- html_step_5_submit = """
3371
- <div class='mock-ui-box' style='margin-bottom: 12px; border-left: 6px solid #f59e0b; background: #fffbeb;'>
3372
- <h3 style='margin-top:0; color: #d97706;'>🏆 Ready to Launch</h3>
3373
- <p>Clicking Build & Submit will:</p>
3374
- <ol style='margin-bottom:10px; padding-left: 20px; font-size: 0.95rem;'>
3375
- <li>Train your model on the selected data.</li>
3376
- <li>Test it on a <strong>Hidden Vault</strong> of future cases.</li>
3377
- <li>Post your score to the <strong>Live Leaderboard</strong>.</li>
3378
- </ol>
3379
- </div>
3380
- """
3381
-
3382
3460
  with gr.Blocks(theme=gr.themes.Soft(primary_hue="indigo"), css=css) as demo:
3383
3461
  # Persistent top anchor for scroll-to-top navigation
3384
3462
  gr.HTML("<div id='app_top_anchor' style='height:0;'></div>")
@@ -3407,157 +3485,165 @@ def create_model_building_game_en_app(theme_primary_hue: str = "indigo") -> "gr.
3407
3485
 
3408
3486
  # --- Briefing Slideshow (Updated with New Cards) ---
3409
3487
 
3410
- # Slide 1: From Understanding to Building (Retained as transition)
3488
+ # Slide 1: Intro
3411
3489
  with gr.Column(visible=True, elem_id="slide-1") as briefing_slide_1:
3412
3490
  gr.Markdown("<h1 style='text-align:center;'>🔄 From Understanding to Building</h1>")
3413
- gr.HTML(
3414
- """
3491
+ gr.HTML("""
3415
3492
  <div class='slide-content'>
3416
3493
  <div class='panel-box'>
3417
3494
  <h3 style='font-size: 1.5rem; text-align:center; margin-top:0;'>Great progress! You've now:</h3>
3418
-
3419
3495
  <ul style='list-style: none; padding-left: 0; margin-top: 24px; margin-bottom: 24px;'>
3420
- <li style='font-size: 1.1rem; font-weight: 500; margin-bottom: 12px;'>
3421
- <span style='font-size: 1.5rem; vertical-align: middle;'>✅</span>
3422
- Made tough decisions as a judge using AI predictions
3423
- </li>
3424
- <li style='font-size: 1.1rem; font-weight: 500; margin-bottom: 12px;'>
3425
- <span style='font-size: 1.5rem; vertical-align: middle;'>✅</span>
3426
- Learned about false positives (false alarms) and false negatives (missed warnings)
3427
- </li>
3428
- <li style='font-size: 1.1rem; font-weight: 500; margin-bottom: 12px;'>
3429
- <span style='font-size: 1.5rem; vertical-align: middle;'>✅</span>
3430
- Understood how AI works:
3431
- </li>
3496
+ <li style='font-size: 1.1rem; font-weight: 500; margin-bottom: 12px;'>✅ Made tough decisions as a judge</li>
3497
+ <li style='font-size: 1.1rem; font-weight: 500; margin-bottom: 12px;'>✅ Learned about false positives and negatives</li>
3498
+ <li style='font-size: 1.1rem; font-weight: 500; margin-bottom: 12px;'>✅ Understood how AI works</li>
3432
3499
  </ul>
3433
-
3434
3500
  <div style='background:white; padding:16px; border-radius:12px; margin:12px 0; text-align:center;'>
3435
- <div style='display:inline-block; background:#dbeafe; padding:12px 16px; border-radius:8px; margin:4px;'>
3436
- <h3 style='margin:0; color:#0369a1;'>INPUT</h3>
3437
- </div>
3438
- <div style='display:inline-block; font-size:1.5rem; margin:0 8px; color:#6b7280;'>→</div>
3439
- <div style='display:inline-block; background:#fef3c7; padding:12px 16px; border-radius:8px; margin:4px;'>
3440
- <h3 style='margin:0; color:#92400e;'>MODEL</h3>
3441
- </div>
3442
- <div style='display:inline-block; font-size:1.5rem; margin:0 8px; color:#6b7280;'>→</div>
3443
- <div style='display:inline-block; background:#f0fdf4; padding:12px 16px; border-radius:8px; margin:4px;'>
3444
- <h3 style='margin:0; color:#15803d;'>OUTPUT</h3>
3445
- </div>
3501
+ <span style='background:#dbeafe; padding:8px; border-radius:4px; color:#0369a1; font-weight:bold;'>INPUT</span> →
3502
+ <span style='background:#fef3c7; padding:8px; border-radius:4px; color:#92400e; font-weight:bold;'>MODEL</span>
3503
+ <span style='background:#f0fdf4; padding:8px; border-radius:4px; color:#15803d; font-weight:bold;'>OUTPUT</span>
3446
3504
  </div>
3447
-
3448
- <hr style='margin: 24px 0; border-top: 2px solid #c7d2fe;'>
3449
-
3450
- <h3 style='font-size: 1.5rem; text-align:center;'>Now it's time to step into the shoes of an AI Engineer.</h3>
3451
- <p style='font-size: 1.1rem; text-align:center; margin-top: 12px;'>
3452
- <strong>Your New Challenge:</strong> Build AI models that are more accurate than the one you used as a judge.
3453
- </p>
3454
- <p style='font-size: 1.1rem; text-align:center; margin-top: 12px;'>
3455
- Remember: You experienced firsthand how AI predictions affect real people's lives. Use that knowledge to build something better.
3456
- </p>
3505
+ <h3 style='font-size: 1.5rem; text-align:center;'>Now: Step into the shoes of an AI Engineer.</h3>
3457
3506
  </div>
3458
3507
  </div>
3459
- """
3460
- )
3508
+ """)
3461
3509
  briefing_1_next = gr.Button("Next ▶️", variant="primary", size="lg")
3462
3510
 
3463
- # Slide 2: Card 1 (Your Engineering Mission)
3511
+ # Slide 2: Mission
3464
3512
  with gr.Column(visible=False, elem_id="slide-2") as briefing_slide_2:
3465
3513
  gr.Markdown("<h1 style='text-align:center;'>📋 Your Mission - Build Better AI</h1>")
3466
-
3467
- gr.HTML(
3468
- """
3514
+ gr.HTML("""
3469
3515
  <div class='slide-content'>
3470
3516
  <div class='panel-box'>
3471
3517
  <h3>The Mission</h3>
3472
- <p>Build an AI model that helps judges make better decisions. The model you used previously gave you imperfect advice. Your job now is to build a new model that predicts risk more accurately, providing judges with the reliable insights they need to be fair.</p>
3473
-
3474
- <h3>The Competition</h3>
3475
- <p>To do this, you will compete against other engineers! To help you in your mission, you will join an engineering team. Your results will be tracked both individually and as a group in the Live Standings Leaderboards.</p>
3476
- </div>
3477
-
3478
- <div class='leaderboard-box' style='max-width: 600px; margin: 16px auto; text-align: center; padding: 16px;'>
3479
- <p style='font-size: 1.1rem; margin:0;'>You will join a team like...</p>
3480
- <h3 style='font-size: 1.75rem; color: #6b7280; margin: 8px 0;'>
3481
- 🛡️ The Ethical Explorers
3482
- </h3>
3483
- </div>
3484
-
3485
- <div class='mock-ui-box'>
3518
+ <p>Build an AI model that helps judges make better decisions. Your job is to predict risk more accurately than the previous model.</p>
3486
3519
  <h3>The Data Challenge</h3>
3487
- <p>To compete, you have access to thousands of old case files. You have two distinct types of information:</p>
3488
- <ol style='list-style-position: inside; padding-left: 20px;'>
3489
- <li><strong>Defendant Profiles:</strong> This is like what the judge saw at the time of arrest.
3490
- <ul style='margin-left: 20px; list-style-type: disc;'>
3491
- <li><em>Age, Number of Prior Offenses, Type of Charge.</em></li>
3492
- </ul>
3493
- </li>
3494
- <li><strong>Historical Outcomes:</strong> This is what actually happened to those people later.
3495
- <ul style='margin-left: 20px; list-style-type: disc;'>
3496
- <li><em>Did they re-offend within 2 years? (Yes/No)</em></li>
3497
- </ul>
3498
- </li>
3499
- </ol>
3500
-
3501
- <h3>The Core Task</h3>
3502
- <p>You need to teach your AI to look at the "Profiles" and accurately predict the "Outcome."</p>
3503
- <p><strong>Ready to build something that could change how justice works?</strong></p>
3520
+ <p>You have access to thousands of old case files containing <b>Defendant Profiles</b> (Age, History) and <b>Historical Outcomes</b> (Did they re-offend?).</p>
3504
3521
  </div>
3505
3522
  </div>
3506
- """
3507
- )
3508
-
3523
+ """)
3509
3524
  with gr.Row():
3510
3525
  briefing_2_back = gr.Button("◀️ Back", size="lg")
3511
3526
  briefing_2_next = gr.Button("Next ▶️", variant="primary", size="lg")
3512
3527
 
3513
- # Slide 3: Card 2 (What is a "Model"?)
3528
+ # Slide 3: Concept
3514
3529
  with gr.Column(visible=False, elem_id="slide-3") as briefing_slide_3:
3515
3530
  gr.Markdown("<h1 style='text-align:center;'>🧠 What is an AI System?</h1>")
3531
+ gr.HTML("""
3532
+ <div class='slide-content'>
3533
+ <div class='panel-box'>
3534
+ <p>Think of an AI System as a "Prediction Machine." You assemble it using three main components:</p>
3535
+ <p><strong>1. The Inputs:</strong> The data you feed it (Age, Crimes).</p>
3536
+ <p><strong>2. The Model ("The Brain"):</strong> The math that finds patterns.</p>
3537
+ <p><strong>3. The Output:</strong> The prediction (Risk Level).</p>
3538
+ </div>
3539
+ </div>
3540
+ """)
3541
+ with gr.Row():
3542
+ briefing_3_back = gr.Button("◀️ Back", size="lg")
3543
+ briefing_3_next = gr.Button("Next ▶️", variant="primary", size="lg")
3544
+
3545
+ # Slide 4: The Loop
3546
+ with gr.Column(visible=False, elem_id="slide-4") as briefing_slide_4:
3547
+ gr.Markdown("<h1 style='text-align:center;'>🔁 How Engineers Work — The Loop</h1>")
3548
+ gr.HTML("""
3549
+ <div class='slide-content'>
3550
+ <div class='panel-box'>
3551
+ <p>Real AI teams never get it right on the first try. They follow a loop: <strong>Try, Test, Learn, Repeat.</strong></p>
3552
+ <div class='step-visual'>
3553
+ <div class='step-visual-box'><b>1. Configure</b></div>→
3554
+ <div class='step-visual-box'><b>2. Submit</b></div>→
3555
+ <div class='step-visual-box'><b>3. Analyze</b></div>→
3556
+ <div class='step-visual-box'><b>4. Refine</b></div>
3557
+ </div>
3558
+ </div>
3559
+ </div>
3560
+ """)
3561
+ # --- END FIX ---
3516
3562
 
3517
- # --- FIX FOR SLIDE 3 ---
3563
+ with gr.Row():
3564
+ briefing_4_back = gr.Button("◀️ Back", size="lg")
3565
+ briefing_4_next = gr.Button("Next ▶️", variant="primary", size="lg")
3566
+
3567
+ with gr.Column(visible=False, elem_id="slide-5") as briefing_slide_5:
3568
+ # --- FIX FOR SLIDE 4 ---
3518
3569
  # Combined all content into single gr.HTML()
3519
3570
  gr.HTML(
3520
3571
  """
3521
3572
  <div class='slide-content'>
3522
3573
  <div class='panel-box'>
3523
- <p>Before we start competing, let's break down exactly what you are building.</p>
3524
- <h3>Think of an AI System as a "Prediction Machine."</h3>
3525
- <p>You already know the flow:</p>
3526
-
3527
- <div style='background:white; padding:16px; border-radius:12px; margin:12px 0; text-align:center;'>
3528
- <div style='display:inline-block; background:#dbeafe; padding:12px 16px; border-radius:8px; margin:4px;'>
3529
- <h3 style='margin:0; color:#0369a1;'>INPUT</h3>
3574
+ <div class='t-minus-header'>
3575
+ <h2 class='t-minus-title'>SYSTEMS CHECK</h2>
3576
+ </div>
3577
+
3578
+ <div style='background:#eff6ff; border:1px solid #bfdbfe; padding:16px; border-radius:10px; text-align:center; margin-bottom:24px;'>
3579
+ <strong style='color:#1e40af; font-size:1.1rem;'>⚠️ SIMULATION MODE ACTIVE</strong>
3580
+ <p style='margin:8px 0 0 0; color:#1e3a8a; font-size:1.05rem; line-height:1.4;'>
3581
+ Below are the <b>exact 4 controls</b> you will use to build your model in the next step.<br>
3582
+ <b>Click each one now</b> to learn what they do before the competition starts.
3583
+ </p>
3584
+ </div>
3585
+
3586
+ <!-- 1. Model Strategy -->
3587
+ <details class="styled-details">
3588
+ <summary>1. Model Strategy (The Engine)</summary>
3589
+ <div class="content">
3590
+ <div class="widget-row"><span class="radio-circle selected"></span> <b>The Balanced Generalist</b></div>
3591
+ <div class="widget-row"><span class="radio-circle"></span> The Rule-Maker</div>
3592
+ <div class="widget-row"><span class="radio-circle"></span> The Deep Pattern-Finder</div>
3593
+
3594
+ <div class="info-popup">
3595
+ <b>In the Game:</b> You will choose one of these model strategies.<br>
3596
+ <i>Tip: Start with "Balanced Generalist" for a safe, reliable baseline score.</i>
3597
+ </div>
3530
3598
  </div>
3531
- <div style='display:inline-block; font-size:1.5rem; margin:0 8px; color:#6b7280;'>→</div>
3532
- <div style='display:inline-block; background:#fef3c7; padding:12px 16px; border-radius:8px; margin:4px;'>
3533
- <h3 style='margin:0; color:#92400e;'>MODEL</h3>
3599
+ </details>
3600
+
3601
+ <!-- 2. Model Complexity -->
3602
+ <details class="styled-details">
3603
+ <summary>2. Model Complexity (Focus Level)</summary>
3604
+ <div class="content">
3605
+ <div class="slider-track"><div class="slider-thumb"></div></div>
3606
+ <div style="display:flex; justify-content:space-between; font-size:0.8rem; color:var(--text-muted);">
3607
+ <span>Level 1 (General)</span>
3608
+ <span>Level 10 (Specific)</span>
3609
+ </div>
3610
+
3611
+ <div class="info-popup">
3612
+ <b>In the Game:</b> You will slide this to adjust how hard the AI studies.<br>
3613
+ <strong style="color:#ef4444;">⚠️ Warning:</strong> Higher isn't always better. Too high = "Overthinking" (memorizing noise).
3614
+ </div>
3534
3615
  </div>
3535
- <div style='display:inline-block; font-size:1.5rem; margin:0 8px; color:#6b7280;'>→</div>
3536
- <div style='display:inline-block; background:#f0fdf4; padding:12px 16px; border-radius:8px; margin:4px;'>
3537
- <h3 style='margin:0; color:#15803d;'>OUTPUT</h3>
3616
+ </details>
3617
+
3618
+ <!-- 3. Data Ingredients -->
3619
+ <details class="styled-details">
3620
+ <summary>3. Data Ingredients (The Fuel)</summary>
3621
+ <div class="content">
3622
+ <div class="widget-row"><span class="check-square checked"></span> <b>Prior Crimes</b></div>
3623
+ <div class="widget-row"><span class="check-square checked"></span> <b>Charge Degree</b></div>
3624
+ <div class="widget-row"><span class="check-square"></span> <b>Demographics (Race/Sex)</b> <span class="risk-tag">⚠️ RISK</span></div>
3625
+
3626
+ <div class="info-popup">
3627
+ <b>In the Game:</b> You will check boxes to decide what the AI is allowed to know.<br>
3628
+ <strong style="color:#ef4444;">⚠️ Ethical Risk:</strong> You <i>can</i> use demographics to boost your score, but is it fair?
3629
+ </div>
3538
3630
  </div>
3539
- </div>
3540
-
3541
- <p>As an engineer, you don't need to write complex code from scratch. Instead, you assemble this machine using three main components.</p>
3542
- </div>
3543
-
3544
- <div class='mock-ui-box'>
3545
- <h3>The 3 Components:</h3>
3546
- <p><strong>1. The Inputs (Data)</strong><br>
3547
- The information you feed the machine.<br>
3548
- <em>* Examples: Age, Prior Crimes, Charge Details.</em></p>
3549
-
3550
- <p><strong>2. The Model ("The Brain")</strong><br>
3551
- This is the "brain" of your machine. It studies the inputs (data) and tries to figure out how things are connected to make a guess. There are different model strategies (brains) that you can choose for your machine.<br>
3552
- <em>* Examples: Some "brains" or strategies only find simple rules (like flagging an email if it says 'free money). Other strategies have the ability to find deep, complex patterns (like recognizing a specific person's face in a crowd.</em></p>
3553
-
3554
- <p><strong>3. The Output (Prediction)</strong><br>
3555
- The model's best guess.<br>
3556
- <em>* Example: Risk Level: High or Low.</em></p>
3557
-
3558
- <hr>
3559
-
3560
- <p><strong>How it learns:</strong> You show the model thousands of old cases (Inputs) + what actually happened (Outcomes). It studies them to find the rules, so it can make predictions on new cases it hasn't seen before.</p>
3631
+ </details>
3632
+
3633
+ <!-- 4. Data Size -->
3634
+ <details class="styled-details">
3635
+ <summary>4. Data Size (Volume)</summary>
3636
+ <div class="content">
3637
+ <div class="widget-row"><span class="radio-circle selected"></span> <b>Small (20%)</b> - Fast Test</div>
3638
+ <div class="widget-row"><span class="radio-circle"></span> <b>Full (100%)</b> - Max Accuracy</div>
3639
+
3640
+ <div class="info-popup">
3641
+ <b>In the Game:</b> You choose how much history the model reads.<br>
3642
+ <i>Tip: Use "Small" to test ideas quickly. Use "Full" when you think you have a winning strategy.</i>
3643
+ </div>
3644
+ </div>
3645
+ </details>
3646
+
3561
3647
  </div>
3562
3648
  </div>
3563
3649
  """
@@ -3565,45 +3651,51 @@ def create_model_building_game_en_app(theme_primary_hue: str = "indigo") -> "gr.
3565
3651
  # --- END FIX ---
3566
3652
 
3567
3653
  with gr.Row():
3568
- briefing_3_back = gr.Button("◀️ Back", size="lg")
3569
- briefing_3_next = gr.Button("Next ▶️", variant="primary", size="lg")
3570
-
3571
- # Slide 4: Card 3 (How Engineers Work — The Loop)
3572
- with gr.Column(visible=False, elem_id="slide-4") as briefing_slide_4:
3573
- gr.Markdown("<h1 style='text-align:center;'>🔁 How Engineers Work — The Loop</h1>")
3654
+ briefing_5_back = gr.Button("◀️ Back", size="lg")
3655
+ briefing_5_next = gr.Button("Next ▶️", variant="primary", size="lg")
3574
3656
 
3575
- # --- FIX FOR SLIDE 4 ---
3657
+ # Slide 5: Card 4 (Control Knobs — The "Brain" Settings)
3658
+ with gr.Column(visible=False, elem_id="slide-6") as briefing_slide_6:
3659
+ # --- FIX FOR SLIDE 5 ---
3576
3660
  # Combined all content into single gr.HTML()
3577
3661
  gr.HTML(
3578
3662
  """
3579
3663
  <div class='slide-content'>
3580
3664
  <div class='panel-box'>
3581
- <p>Now that you know the components of a model, how do you build a better one?</p>
3582
- <h3>Here is the secret:</h3>
3583
- <p>Real AI teams almost never get it right on the first try. Instead, they follow a continuous loop of experimentation: <strong>Try, Test, Learn, Repeat.</strong></p>
3665
+ <div class='t-minus-header'>
3666
+ <h2 class='t-minus-title'>FINAL CLEARANCE</h2>
3667
+ </div>
3584
3668
 
3585
- <h3>The Experiment Loop:</h3>
3586
- <ol style='list-style-position: inside;'>
3587
- <li><strong>Build a Model:</strong> Assemble your components and get a starting prediction accuracy score.</li>
3588
- <li><strong>Ask a Question:</strong> (e.g., "What happens if I change the 'Brain' type?")</li>
3589
- <li><strong>Test & Compare:</strong> Did the score get better... or did it get worse?</li>
3590
- </ol>
3591
- </div>
3592
-
3593
- <h3>You will do the exact same thing in a competition!</h3>
3594
-
3595
- <div class='step-visual'>
3596
- <div class='step-visual-box'><b>1. Configure</b><br/>Use Control Knobs to select Strategy and Data.</div>
3597
- <div class='step-visual-arrow'>→</div>
3598
- <div class='step-visual-box'><b>2. Submit</b><br/>Click "Build & Submit" to train your model.</div>
3599
- <div class='step-visual-arrow'>→</div>
3600
- <div class='step-visual-box'><b>3. Analyze</b><br/>Check your rank on the Live Leaderboard.</div>
3601
- <div class='step-visual-arrow'>→</div>
3602
- <div class='step-visual-box'><b>4. Refine</b><br/>Change one setting and submit again!</div>
3603
- </div>
3604
-
3605
- <div class='leaderboard-box' style='text-align:center;'>
3606
- <p><strong>Pro Tip:</strong> Try to change only one thing at a time. If you change too many things at once, you won't know what made your model better or worse!</p>
3669
+ <p style='font-size: 1.15rem; text-align:center; margin-bottom: 24px;'>
3670
+ <b>Anti-Cheat System Active.</b> You are cleared to begin competing.
3671
+ </p>
3672
+
3673
+ <div style='background:var(--prose-background-fill); padding:20px; border-radius:12px; text-align:left; margin-bottom:24px; display:flex; align-items:center; gap:16px;'>
3674
+ <div style='font-size:2.5rem;'>🔐</div>
3675
+ <div>
3676
+ <strong style='font-size:1.1rem;'>How to Win</strong>
3677
+ <p style='margin:4px 0 0 0; color:var(--text-muted); font-size:0.95rem;'>
3678
+ We have hidden 20% of the cases. Your model <b>never</b> sees them.
3679
+ Your final score indicates how accurate your AI system is at predicting this data.
3680
+ 50% prediction accuracy means your AI system predicts half of the hidden cases correctly.
3681
+ </p>
3682
+ </div>
3683
+ </div>
3684
+
3685
+ <div style='text-align:center; border-top:1px solid var(--card-border-subtle); padding-top:20px; margin-bottom:30px;'>
3686
+ <h3 style='margin:0 0 12px 0; font-size:1.2rem;'>Unlockable Ranks</h3>
3687
+ <div style='display:inline-flex; gap:12px; flex-wrap:wrap; justify-content:center;'>
3688
+ <span style='padding:6px 12px; background:#f3f4f6; border-radius:20px; font-size:0.9rem;'>⭐ Rookie</span>
3689
+ <span style='padding:6px 12px; background:#e0e7ff; border-radius:20px; font-size:0.9rem; color:#4338ca;'>⭐⭐ Junior</span>
3690
+ <span style='padding:6px 12px; background:#fae8ff; border-radius:20px; font-size:0.9rem; color:#86198f;'>⭐⭐⭐ Lead Engineer</span>
3691
+ </div>
3692
+ </div>
3693
+
3694
+ <div style='text-align:center; background: color-mix(in srgb, var(--color-accent) 10%, transparent); padding: 20px; border-radius: 12px; border: 2px solid var(--color-accent);'>
3695
+ <p style='margin:0 0 8px 0; font-size: 1.1rem; color: var(--text-muted);'>To start the competition:</p>
3696
+ <b style='color:var(--accent-strong); font-size:1.3rem;'>Click "Begin", then "Build & Submit Model"</b>
3697
+ <p style='margin:8px 0 0 0; font-size: 1rem;'>This will make your first submission to the leaderboard.</p>
3698
+ </div>
3607
3699
  </div>
3608
3700
  </div>
3609
3701
  """
@@ -3611,13 +3703,31 @@ def create_model_building_game_en_app(theme_primary_hue: str = "indigo") -> "gr.
3611
3703
  # --- END FIX ---
3612
3704
 
3613
3705
  with gr.Row():
3614
- briefing_4_back = gr.Button("◀️ Back", size="lg")
3615
- briefing_4_next = gr.Button("Next ▶️", variant="primary", size="lg")
3706
+ briefing_6_back = gr.Button("◀️ Back", size="lg")
3707
+ briefing_6_next = gr.Button("Begin Model Building ▶️", variant="primary", size="lg")
3616
3708
 
3709
+ # --- End Briefing Slideshow ---
3617
3710
 
3618
- # --- MODEL BUILDING ARENA ---
3619
- # Note: visible=True immediately.
3711
+
3712
+ # Model Building App (Main Interface)
3620
3713
  with gr.Column(visible=False, elem_id="model-step") as model_building_step:
3714
+ gr.Markdown("<h1 style='text-align:center;'>🛠️ Model Building Arena</h1>")
3715
+
3716
+ # Status panel for initialization progress - HIDDEN
3717
+ init_status_display = gr.HTML(value="", visible=False)
3718
+
3719
+ # Banner for UI state
3720
+
3721
+ init_banner = gr.HTML(
3722
+ value=(
3723
+ "<div class='init-banner'>"
3724
+ "<p class='init-banner__text'>"
3725
+ "⏳ Initializing data & leaderboard… you can explore but must wait for readiness to submit."
3726
+ "</p>"
3727
+ "</div>"
3728
+ ),
3729
+ visible=True)
3730
+
3621
3731
  # Session-based authentication state objects
3622
3732
  # Concurrency Note: These are initialized to None/empty and populated
3623
3733
  # during handle_load_with_session_auth. Do NOT use os.environ here.
@@ -3644,91 +3754,110 @@ def create_model_building_game_en_app(theme_primary_hue: str = "indigo") -> "gr.
3644
3754
  data_size_state = gr.State(DEFAULT_DATA_SIZE)
3645
3755
 
3646
3756
  rank_message_display = gr.Markdown("### Rank loading...")
3647
-
3648
- # New State to track if instructions should be hidden
3649
- onboarding_complete_state = gr.State(False)
3650
-
3651
- gr.Markdown("# 🛠️ Model Building Arena")
3652
-
3653
- rank_message_display = gr.HTML(visible=False)
3654
-
3655
3757
  with gr.Row():
3656
- # === LEFT COLUMN: Controls & Instructions ===
3657
- with gr.Column(scale=1, elem_classes="control-panel") as left_col:
3658
-
3659
- # STEP 1: Strategy (Visible Start)
3660
- step_1_box = gr.Group(visible=True)
3661
- with step_1_box:
3662
- instr_1 = gr.HTML(html_step_1_brain)
3663
- model_type_radio = gr.Radio(
3664
- label="1. Select Strategy",
3665
- choices=list(MODEL_TYPES.keys()),
3666
- value=DEFAULT_MODEL,
3667
- interactive=True
3668
- )
3669
- model_card_display = gr.Markdown(get_model_card(DEFAULT_MODEL), visible=False)
3670
-
3671
- # STEP 2: Complexity (Hidden Start)
3672
- step_2_box = gr.Group(visible=False)
3673
- with step_2_box:
3674
- instr_2 = gr.HTML(html_step_2_complexity)
3675
- complexity_slider = gr.Slider(
3676
- label="2. Set Complexity Level",
3677
- minimum=1, maximum=3, step=1, value=2,
3678
- interactive=True
3679
- )
3680
-
3681
- # STEP 3: Ingredients (Hidden Start)
3682
- step_3_box = gr.Group(visible=False)
3683
- with step_3_box:
3684
- instr_3 = gr.HTML(html_step_3_ingredients)
3685
- feature_set_checkbox = gr.CheckboxGroup(
3686
- label="3. Select Ingredients",
3687
- choices=FEATURE_SET_ALL_OPTIONS,
3688
- value=DEFAULT_FEATURE_SET,
3689
- interactive=True
3690
- )
3691
-
3692
- # STEP 4: Data Size (Hidden Start)
3693
- step_4_box = gr.Group(visible=False)
3694
- with step_4_box:
3695
- instr_4 = gr.HTML(html_step_4_size)
3696
- data_size_radio = gr.Radio(
3697
- label="4. Select Dataset Size",
3698
- choices=[DEFAULT_DATA_SIZE],
3699
- value=DEFAULT_DATA_SIZE,
3700
- interactive=True
3701
- )
3758
+ with gr.Column(scale=1):
3759
+
3760
+ model_type_radio = gr.Radio(
3761
+ label="1. Model Strategy",
3762
+ # Initialize with all possible keys so validation passes even if browser caches a high-rank selection
3763
+ choices=list(MODEL_TYPES.keys()),
3764
+ value=DEFAULT_MODEL,
3765
+ interactive=False
3766
+ )
3767
+ model_card_display = gr.Markdown(get_model_card(DEFAULT_MODEL))
3768
+
3769
+ gr.Markdown("---") # Separator
3770
+
3771
+ complexity_slider = gr.Slider(
3772
+ label="2. Model Complexity (1–10)",
3773
+ minimum=1, maximum=3, step=1, value=2,
3774
+ info="Higher values allow deeper pattern learning; very high values may overfit."
3775
+ )
3776
+
3777
+ gr.Markdown("---") # Separator
3778
+
3779
+ feature_set_checkbox = gr.CheckboxGroup(
3780
+ label="3. Select Data Ingredients",
3781
+ choices=FEATURE_SET_ALL_OPTIONS,
3782
+ value=DEFAULT_FEATURE_SET,
3783
+ interactive=False,
3784
+ info="More ingredients unlock as you rank up!"
3785
+ )
3786
+
3787
+ gr.Markdown("---") # Separator
3788
+
3789
+ data_size_radio = gr.Radio(
3790
+ label="4. Data Size",
3791
+ choices=[DEFAULT_DATA_SIZE],
3792
+ value=DEFAULT_DATA_SIZE,
3793
+ interactive=False
3794
+ )
3795
+
3796
+ gr.Markdown("---") # Separator
3797
+
3798
+ # Attempt tracker display
3799
+ attempts_tracker_display = gr.HTML(
3800
+ value="<div style='text-align:center; padding:8px; margin:8px 0; background:#f0f9ff; border-radius:8px; border:1px solid #bae6fd;'>"
3801
+ "<p style='margin:0; color:#0369a1; font-weight:600; font-size:1rem;'>📊 Attempts used: 0/10</p>"
3802
+ "</div>",
3803
+ visible=True
3804
+ )
3805
+
3806
+ submit_button = gr.Button(
3807
+ value="5. 🔬 Build & Submit Model",
3808
+ variant="primary",
3809
+ size="lg"
3810
+ )
3811
+
3812
+ with gr.Column(scale=1):
3813
+ gr.HTML(
3814
+ """
3815
+ <div class='leaderboard-box'>
3816
+ <h3 style='margin-top:0;'>🏆 Live Standings</h3>
3817
+ <p style='margin:0;'>Submit a model to see your rank.</p>
3818
+ </div>
3819
+ """
3820
+ )
3702
3821
 
3703
- # STEP 5: Submit (Hidden Start)
3704
- step_5_box = gr.Group(visible=False)
3705
- with step_5_box:
3706
- instr_5 = gr.HTML(html_step_5_submit)
3707
- attempts_tracker_display = gr.HTML(
3708
- value=_build_attempts_tracker_html(0), visible=True
3709
- )
3710
- submit_button = gr.Button(
3711
- value="🚀 Build & Submit Model", variant="primary", size="lg"
3712
- )
3822
+ # KPI Card
3823
+ submission_feedback_display = gr.HTML(
3824
+ "<p style='text-align:center; color:#6b7280; padding:20px 0;'>Submit your first model to get feedback!</p>"
3825
+ )
3713
3826
 
3714
- # Inline Login (Hidden)
3715
- login_username = gr.Textbox(label="Username", visible=False)
3716
- login_password = gr.Textbox(label="Password", type="password", visible=False)
3717
- login_submit = gr.Button("Sign In & Submit", variant="primary", visible=False)
3718
- login_error = gr.HTML(visible=False)
3719
-
3720
- # === RIGHT COLUMN: Results (Hidden Start) ===
3721
- with gr.Column(scale=1, visible=False) as right_col:
3722
- gr.HTML("<h3 style='margin-top:0;'>🏆 Live Standings</h3>")
3723
- submission_feedback_display = gr.HTML("Loading results...")
3827
+ # Inline Login Components (initially hidden)
3828
+ login_username = gr.Textbox(
3829
+ label="Username",
3830
+ placeholder="Enter your modelshare.ai username",
3831
+ visible=False
3832
+ )
3833
+ login_password = gr.Textbox(
3834
+ label="Password",
3835
+ type="password",
3836
+ placeholder="Enter your password",
3837
+ visible=False
3838
+ )
3839
+ login_submit = gr.Button(
3840
+ "Sign In & Submit",
3841
+ variant="primary",
3842
+ visible=False
3843
+ )
3844
+ login_error = gr.HTML(
3845
+ value="",
3846
+ visible=False
3847
+ )
3848
+
3724
3849
  with gr.Tabs():
3725
- with gr.TabItem("Team"):
3726
- team_leaderboard_display = gr.HTML()
3727
- with gr.TabItem("Individual"):
3728
- individual_leaderboard_display = gr.HTML()
3729
- gr.Markdown("---")
3730
- step_2_next = gr.Button("Finish & Reflect ▶️", variant="secondary")
3850
+ with gr.TabItem("Team Standings"):
3851
+ team_leaderboard_display = gr.HTML(
3852
+ "<p style='text-align:center; color:#6b7280; padding-top:20px;'>Submit a model to see team rankings.</p>"
3853
+ )
3854
+ with gr.TabItem("Individual Standings"):
3855
+ individual_leaderboard_display = gr.HTML(
3856
+ "<p style='text-align:center; color:#6b7280; padding-top:20px;'>Submit a model to see individual rankings.</p>"
3857
+ )
3731
3858
 
3859
+ # REMOVED: Ethical Reminder HTML Block
3860
+ step_2_next = gr.Button("Finish & Reflect ▶️", variant="secondary")
3732
3861
 
3733
3862
  # Conclusion Step
3734
3863
  with gr.Column(visible=False, elem_id="conclusion-step") as conclusion_step:
@@ -3738,12 +3867,18 @@ def create_model_building_game_en_app(theme_primary_hue: str = "indigo") -> "gr.
3738
3867
 
3739
3868
  # --- Navigation Logic ---
3740
3869
  all_steps_nav = [
3741
- briefing_slide_1, briefing_slide_2, briefing_slide_3, briefing_slide_4,
3870
+ briefing_slide_1, briefing_slide_2, briefing_slide_3,
3871
+ briefing_slide_4, briefing_slide_5, briefing_slide_6,
3742
3872
  model_building_step, conclusion_step, loading_screen
3743
3873
  ]
3744
3874
 
3745
3875
  def create_nav(current_step, next_step):
3876
+ """
3877
+ Simplified navigation: directly switches visibility without artificial loading screen.
3878
+ Loading screen only shown when entering arena if not yet ready.
3879
+ """
3746
3880
  def _nav():
3881
+ # Direct single-step navigation
3747
3882
  updates = {next_step: gr.update(visible=True)}
3748
3883
  for s in all_steps_nav:
3749
3884
  if s != next_step:
@@ -3846,95 +3981,82 @@ def create_model_building_game_en_app(theme_primary_hue: str = "indigo") -> "gr.
3846
3981
  """
3847
3982
 
3848
3983
 
3849
- # 2. Wire Slide 1-4 Navigation (Keep existing)
3850
- briefing_1_next.click(fn=create_nav(briefing_slide_1, briefing_slide_2), inputs=None, outputs=all_steps_nav, js=nav_js("slide-2", "Loading mission..."))
3851
- briefing_2_back.click(fn=create_nav(briefing_slide_2, briefing_slide_1), inputs=None, outputs=all_steps_nav, js=nav_js("slide-1", "Returning..."))
3852
- briefing_2_next.click(fn=create_nav(briefing_slide_2, briefing_slide_3), inputs=None, outputs=all_steps_nav, js=nav_js("slide-3", "Next slide..."))
3853
- briefing_3_back.click(fn=create_nav(briefing_slide_3, briefing_slide_2), inputs=None, outputs=all_steps_nav, js=nav_js("slide-2", "Back..."))
3854
- briefing_3_next.click(fn=create_nav(briefing_slide_3, briefing_slide_4), inputs=None, outputs=all_steps_nav, js=nav_js("slide-4", "Next slide..."))
3855
- briefing_4_back.click(fn=create_nav(briefing_slide_4, briefing_slide_3), inputs=None, outputs=all_steps_nav, js=nav_js("slide-3", "Back..."))
3856
-
3857
- # 3. CRITICAL UPDATE: Slide 4 Button -> Jumps to App (model-step)
3984
+ # Wire up slide buttons with enhanced navigation
3985
+ briefing_1_next.click(
3986
+ fn=create_nav(briefing_slide_1, briefing_slide_2),
3987
+ inputs=None, outputs=all_steps_nav,
3988
+ js=nav_js("slide-2", "Loading mission overview...")
3989
+ )
3990
+ briefing_2_back.click(
3991
+ fn=create_nav(briefing_slide_2, briefing_slide_1),
3992
+ inputs=None, outputs=all_steps_nav,
3993
+ js=nav_js("slide-1", "Returning to introduction...")
3994
+ )
3995
+ briefing_2_next.click(
3996
+ fn=create_nav(briefing_slide_2, briefing_slide_3),
3997
+ inputs=None, outputs=all_steps_nav,
3998
+ js=nav_js("slide-3", "Exploring model concept...")
3999
+ )
4000
+ briefing_3_back.click(
4001
+ fn=create_nav(briefing_slide_3, briefing_slide_2),
4002
+ inputs=None, outputs=all_steps_nav,
4003
+ js=nav_js("slide-2", "Going back one step...")
4004
+ )
4005
+ briefing_3_next.click(
4006
+ fn=create_nav(briefing_slide_3, briefing_slide_4),
4007
+ inputs=None, outputs=all_steps_nav,
4008
+ js=nav_js("slide-4", "Understanding the experiment loop...")
4009
+ )
4010
+ briefing_4_back.click(
4011
+ fn=create_nav(briefing_slide_4, briefing_slide_3),
4012
+ inputs=None, outputs=all_steps_nav,
4013
+ js=nav_js("slide-3", "Reviewing previous concepts...")
4014
+ )
3858
4015
  briefing_4_next.click(
3859
- fn=create_nav(briefing_slide_4, model_building_step),
3860
- inputs=None,
3861
- outputs=all_steps_nav,
3862
- js=nav_js("model-step", "Entering Arena...")
4016
+ fn=create_nav(briefing_slide_4, briefing_slide_5),
4017
+ inputs=None, outputs=all_steps_nav,
4018
+ js=nav_js("slide-5", "Configuring brain settings...")
3863
4019
  )
3864
-
3865
- # --- PROGRESSIVE APP LOGIC (The New Stuff) ---
3866
-
3867
- # 1. Strategy -> Unlock Step 2
3868
- model_type_radio.change(fn=lambda: gr.update(visible=True), outputs=step_2_box).then(
3869
- fn=lambda v: v, inputs=model_type_radio, outputs=model_type_state)
3870
-
3871
- # 2. Complexity -> Unlock Step 3
3872
- complexity_slider.release(fn=lambda: gr.update(visible=True), outputs=step_3_box).then(
3873
- fn=lambda v: v, inputs=complexity_slider, outputs=complexity_state)
3874
-
3875
- # 3. Ingredients -> Unlock Step 4
3876
- feature_set_checkbox.change(fn=lambda: gr.update(visible=True), outputs=step_4_box).then(
3877
- fn=lambda v: v, inputs=feature_set_checkbox, outputs=feature_set_state)
3878
-
3879
- # 4. Data Size -> Unlock Step 5
3880
- data_size_radio.change(fn=lambda: gr.update(visible=True), outputs=step_5_box).then(
3881
- fn=lambda v: v, inputs=data_size_radio, outputs=data_size_state)
3882
-
3883
- # 5. Submit Transformation Logic
3884
- def on_submit_finish_onboarding():
3885
- return {
3886
- instr_1: gr.update(visible=False),
3887
- instr_2: gr.update(visible=False),
3888
- instr_3: gr.update(visible=False),
3889
- instr_4: gr.update(visible=False),
3890
- instr_5: gr.update(visible=False),
3891
- right_col: gr.update(visible=True),
3892
- model_card_display: gr.update(visible=True),
3893
- onboarding_complete_state: True
3894
- }
3895
-
3896
- # 6. Wire Submit Button
3897
- submit_button.click(
3898
- fn=run_experiment,
3899
- inputs=[
3900
- model_type_state, complexity_state, feature_set_state, data_size_state,
3901
- team_name_state, last_submission_score_state, last_rank_state,
3902
- submission_count_state, first_submission_score_state, best_score_state,
3903
- username_state, token_state, readiness_state, was_preview_state
3904
- ],
3905
- outputs=[
3906
- submission_feedback_display, team_leaderboard_display, individual_leaderboard_display,
3907
- last_submission_score_state, last_rank_state, best_score_state,
3908
- submission_count_state, first_submission_score_state, rank_message_display,
3909
- model_type_radio, complexity_slider, feature_set_checkbox, data_size_radio,
3910
- submit_button, login_username, login_password, login_submit, login_error,
3911
- attempts_tracker_display, was_preview_state, kpi_meta_state, last_seen_ts_state
3912
- ]
3913
- ).then(
3914
- fn=on_submit_finish_onboarding,
3915
- outputs=[instr_1, instr_2, instr_3, instr_4, instr_5, right_col, model_card_display, onboarding_complete_state]
4020
+ briefing_5_back.click(
4021
+ fn=create_nav(briefing_slide_5, briefing_slide_4),
4022
+ inputs=None, outputs=all_steps_nav,
4023
+ js=nav_js("slide-4", "System check...")
4024
+ )
4025
+ briefing_5_next.click(
4026
+ fn=create_nav(briefing_slide_5,briefing_slide_6),
4027
+ inputs=None, outputs=all_steps_nav,
4028
+ js=nav_js("model-step", "Final Clearance...")
4029
+ )
4030
+ briefing_6_back.click(
4031
+ fn=create_nav(briefing_slide_6, briefing_slide_5),
4032
+ inputs=None, outputs=all_steps_nav,
4033
+ js=nav_js("model-step", "Entering model arena...")
4034
+ )
4035
+ briefing_6_next.click(
4036
+ fn=create_nav(briefing_slide_6, model_building_step),
4037
+ inputs=None, outputs=all_steps_nav,
4038
+ js=nav_js("model-step", "Entering model arena...")
3916
4039
  )
3917
4040
 
3918
- # 7. Finish Button Logic
3919
- def finalize_and_show_conclusion(best_score, submissions, rank, first_score, feature_set):
3920
- html = build_final_conclusion_html(best_score, submissions, rank, first_score, feature_set)
3921
- # Use create_nav helper to ensure clean switching
3922
- updates = create_nav(model_building_step, conclusion_step)()
3923
- updates[final_score_display] = gr.update(value=html)
3924
- return updates
3925
-
4041
+ # App -> Conclusion
3926
4042
  step_2_next.click(
3927
4043
  fn=finalize_and_show_conclusion,
3928
- inputs=[best_score_state, submission_count_state, last_rank_state, first_submission_score_state, feature_set_state],
4044
+ inputs=[
4045
+ best_score_state,
4046
+ submission_count_state,
4047
+ last_rank_state,
4048
+ first_submission_score_state,
4049
+ feature_set_state
4050
+ ],
3929
4051
  outputs=all_steps_nav + [final_score_display],
3930
- js=nav_js("conclusion-step", "Generating summary...")
4052
+ js=nav_js("conclusion-step", "Generating performance summary...")
3931
4053
  )
3932
4054
 
3933
- # Back from conclusion
4055
+ # Conclusion -> App
3934
4056
  step_3_back.click(
3935
4057
  fn=create_nav(conclusion_step, model_building_step),
3936
4058
  inputs=None, outputs=all_steps_nav,
3937
- js=nav_js("model-step", "Returning...")
4059
+ js=nav_js("model-step", "Returning to experiment workspace...")
3938
4060
  )
3939
4061
 
3940
4062
  # Events
@@ -4163,5 +4285,6 @@ def launch_model_building_game_en_app(height: int = 1200, share: bool = False, d
4163
4285
  X_TRAIN_RAW, X_TEST_RAW, Y_TRAIN, Y_TEST = load_and_prep_data()
4164
4286
 
4165
4287
  demo = create_model_building_game_en_app()
4288
+
4166
4289
  port = int(os.environ.get("PORT", 8080))
4167
4290
  demo.launch(share=share, inline=True, debug=debug, height=height, server_port=port)