ysharma HF Staff commited on
Commit
81c91ce
·
verified ·
1 Parent(s): 213b28b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +173 -105
app.py CHANGED
@@ -37,68 +37,58 @@ HEADER_HTML_OLD = """
37
  </div>
38
  """
39
 
40
- HEADER_HTML = """
41
- <div class="bsh-banner-img">
42
- <img src="https://cdn-uploads.huggingface.co/production/uploads/60d2dc1007da9c17c72708f8/Ctx1Jh4nImulMYS2PRClZ.png"
43
- alt="Build Small Hackathon — Small Models, Big Adventures" />
44
- </div>
45
- """
46
-
47
- INFO_ROW_HTML = """
48
- <div class="bsh-info-row">
49
- <div class="bsh-card">
50
- <div class="bsh-title">❋ Two Tracks</div>
51
- <div class="bsh-content">
52
- <div class="bsh-track">
53
- <span class="bsh-emoji">🏡</span>
54
- <span class="bsh-track-name">Backyard AI</span>
 
 
 
 
 
 
 
 
55
  </div>
56
- <div class="bsh-track-desc">Solve a real problem for someone you know</div>
57
- <div class="bsh-track">
58
- <span class="bsh-emoji">🍄</span>
59
- <span class="bsh-track-name">Thousand Token Wood</span>
 
 
 
60
  </div>
61
- <div class="bsh-track-desc">Build something delightful and whimsical</div>
62
- </div>
63
- </div>
64
- <div class="bsh-card">
65
- <div class="bsh-title">✦ Three Rules</div>
66
- <ol class="bsh-rules">
67
- <li>Models ≤ 32B parameters</li>
68
- <li>Built on Gradio + Spaces</li>
69
- <li>Demo video + social post</li>
70
- </ol>
71
- </div>
72
- <div class="bsh-card">
73
- <div class="bsh-title">🎁 Prizes &amp; Credits</div>
74
- <div class="bsh-content">
75
- <div class="bsh-soon"><em>Sponsor lineup, prize pool, and free API/compute credits announcing soon — sit tight, friend.</em></div>
76
- <div class="bsh-link">→ <a href="https://huggingface.co/build-small-hackathon" target="_blank">Read the chapter book</a></div>
77
  </div>
78
- </div>
79
- </div>
80
- """
81
-
82
- DATES_ROW_HTML = """
83
- <div class="bsh-dates-row">
84
- <div class="bsh-dates">
85
- <div class="bsh-title">✦ Trail Map · Key Dates</div>
86
- <div class="bsh-dates-grid">
87
- <div>📅 <b>Reg closes:</b> Wed, June 3 · 23:59 UTC</div>
88
- <div>🎟️ <b>Credits:</b> Thu, June 4</div>
89
- <div>🚀 <b>Hack opens:</b> Fri, June 5 · 00:01 UTC</div>
90
- <div>🏁 <b>Submit by:</b> Mon, June 15 · 23:59 UTC</div>
91
  </div>
92
- <div class="bsh-warn">⛔ No registrations accepted once the event starts. Lock it in before June 3!</div>
93
- </div>
94
- <div class="bsh-counter">
95
- <div class="bsh-counter-title">⏳ Registration closes in</div>
96
- <div class="bsh-counter-target">June 3, 2026 · 23:59 UTC</div>
97
- <div class="bsh-nums">
98
- <div class="bsh-unit"><span class="bsh-num" id="bsh-days">--</span><span class="bsh-lbl">Days</span></div>
99
- <div class="bsh-unit"><span class="bsh-num" id="bsh-hours">--</span><span class="bsh-lbl">Hrs</span></div>
100
- <div class="bsh-unit"><span class="bsh-num" id="bsh-mins">--</span><span class="bsh-lbl">Min</span></div>
101
- <div class="bsh-unit"><span class="bsh-num" id="bsh-secs">--</span><span class="bsh-lbl">Sec</span></div>
102
  </div>
103
  </div>
104
  </div>
@@ -298,27 +288,22 @@ def verify_registration(email, hf_username):
298
 
299
  result = f"""
300
  ## ✅ Registration Confirmed!
301
-
302
  **Participant Details:**
303
  - **Full Name:** {registration['full_name']}
304
  - **Email:** {registration['email']}
305
  - **Hugging Face Username:** {registration['hf_username']}
306
  - **Registered On:** {reg_date}
307
-
308
  **Hackathon Participation:**
309
  - **Track Interest:** {registration['track_interest']}
310
  - **Hackathon Experience:** {prev}
311
  - **Experience Level:** {registration['experience_level']}
312
  - **Gradio Usage:** {registration['gradio_usage']}
313
  - **How You Heard:** {registration['how_heard']}
314
-
315
  **Build Small Plans:**
316
  - **Small Model You Plan to Use:** {planned_model_str}
317
  - **Bonus Quests of Interest:** {quests_str}
318
-
319
  **Project Idea:**
320
  {registration['project_description'] if registration['project_description'] else '_No project description provided_'}
321
-
322
  ---
323
  **Next Steps:**
324
  - 🎟️ API & compute credits will be assigned on **Thu, May 28, 2026**
@@ -393,13 +378,10 @@ def submit_registration(full_name, email, hf_username, gradio_usage,
393
  return f"❌ Registration failed: {message}"
394
 
395
  return f"""✅ Registration Successful!
396
-
397
  Thank you, **{full_name}**! Your spot is locked in.
398
-
399
  🎟️ Credits assigned **Thu, May 28** · 🚀 Hack opens **Fri, May 29** · 🏁 Submissions due **Mon, Jun 8**.<br>
400
  💬 Join the Gradio Discord channel `{DISCORD_CHANNEL}`: {DISCORD_INVITE}<br>
401
  📧 Watch your email for credits and updates.
402
-
403
  **See you in the woods! 🍄🪵**"""
404
 
405
 
@@ -469,9 +451,23 @@ body.dark .gradio-container,
469
  --bsh-link: #9bc466;
470
  }
471
 
472
- /* Banner */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
473
  .bsh-banner-img {
474
- margin: 0 0 12px 0;
475
  border-radius: 14px;
476
  overflow: hidden;
477
  border: 1px solid var(--bsh-card-border);
@@ -484,13 +480,108 @@ body.dark .gradio-container,
484
  height: auto;
485
  }
486
 
487
- /* Three-card info row */
488
- .bsh-info-row {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
489
  display: grid;
490
- grid-template-columns: 1fr 1fr 1fr;
491
- gap: 10px;
492
- margin-bottom: 12px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
493
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
494
  .bsh-card {
495
  background: var(--bsh-card-bg);
496
  border: 1px solid var(--bsh-card-border);
@@ -541,29 +632,8 @@ body.dark .gradio-container,
541
  line-height: 1.7;
542
  color: var(--bsh-text);
543
  }
544
- .bsh-soon {
545
- font-size: 13px;
546
- line-height: 1.55;
547
- color: var(--bsh-text);
548
- opacity: 0.92;
549
- }
550
- .bsh-link {
551
- margin-top: 6px;
552
- font-size: 12px;
553
- }
554
- .bsh-link a {
555
- color: var(--bsh-link);
556
- font-weight: 600;
557
- text-decoration: underline;
558
- }
559
 
560
- /* Dates + countdown row */
561
- .bsh-dates-row {
562
- display: grid;
563
- grid-template-columns: 1.6fr 1fr;
564
- gap: 10px;
565
- margin-bottom: 14px;
566
- }
567
  .bsh-dates {
568
  background: var(--bsh-card-bg);
569
  border: 1px solid var(--bsh-card-border);
@@ -590,6 +660,8 @@ body.dark .gradio-container,
590
  font-weight: 600;
591
  text-align: center;
592
  }
 
 
593
  .bsh-counter {
594
  background: var(--bsh-counter-bg);
595
  border: 1px solid var(--bsh-card-border);
@@ -641,7 +713,7 @@ body.dark .gradio-container,
641
  text-transform: uppercase;
642
  }
643
 
644
- /* Discord ribbon */
645
  .bsh-discord {
646
  margin-top: 14px;
647
  background: var(--bsh-discord-bg);
@@ -666,7 +738,7 @@ body.dark .gradio-container,
666
  color: var(--bsh-text);
667
  }
668
 
669
- /* Buttons */
670
  #submit-btn {
671
  background: linear-gradient(135deg, #4a7c2e 0%, #2d5016 100%) !important;
672
  border: 1px solid #6b4423 !important;
@@ -698,10 +770,9 @@ body.dark .gradio-container,
698
  background: #7d5430 !important;
699
  }
700
 
701
- /* Responsive */
702
  @media (max-width: 760px) {
703
- .bsh-info-row { grid-template-columns: 1fr; }
704
- .bsh-dates-row { grid-template-columns: 1fr; }
705
  }
706
  """
707
 
@@ -712,9 +783,7 @@ with gr.Blocks(
712
  theme=gr.themes.Soft(primary_hue="green", secondary_hue="amber", neutral_hue="stone"),
713
  ) as demo:
714
 
715
- gr.HTML(HEADER_HTML)
716
- gr.HTML(INFO_ROW_HTML)
717
- gr.HTML(DATES_ROW_HTML)
718
 
719
  with gr.Tabs():
720
  with gr.Tab("📝 Register"):
@@ -912,7 +981,6 @@ with gr.Blocks(
912
  - Use the **exact** email and username you registered with
913
  - Both fields are case-insensitive but must match
914
  - Registration is open until **Wed, May 27, 2026 · 23:59 UTC** — once it closes, no new entries can be added
915
-
916
  **Support:**
917
  - Discord: [{DISCORD_INVITE}]({DISCORD_INVITE}) (channel `{DISCORD_CHANNEL}`)
918
  - Email: gradio-team@huggingface.co
@@ -937,4 +1005,4 @@ with gr.Blocks(
937
 
938
 
939
  if __name__ == "__main__":
940
- demo.launch(allowed_paths=["."])
 
37
  </div>
38
  """
39
 
40
+ # Hero layout: banner on the left, stacked info cards on the right.
41
+ HERO_HTML = """
42
+ <div class="bsh-hero-grid">
43
+ <div class="bsh-banner-img">
44
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/60d2dc1007da9c17c72708f8/Ctx1Jh4nImulMYS2PRClZ.png"
45
+ alt="Build Small Hackathon — Small Models, Big Adventures" />
46
+ </div>
47
+ <div class="bsh-hero-side">
48
+ <div class="bsh-hero-pair">
49
+ <div class="bsh-card">
50
+ <div class="bsh-title">❋ Two Tracks</div>
51
+ <div class="bsh-content">
52
+ <div class="bsh-track">
53
+ <span class="bsh-emoji">🏡</span>
54
+ <span class="bsh-track-name">Backyard AI</span>
55
+ </div>
56
+ <div class="bsh-track-desc">Solve a real problem for someone you know</div>
57
+ <div class="bsh-track">
58
+ <span class="bsh-emoji">🍄</span>
59
+ <span class="bsh-track-name">Thousand Token Wood</span>
60
+ </div>
61
+ <div class="bsh-track-desc">Build something delightful and whimsical</div>
62
+ </div>
63
  </div>
64
+ <div class="bsh-card">
65
+ <div class="bsh-title">✦ Three Rules</div>
66
+ <ol class="bsh-rules">
67
+ <li>Models 32B parameters</li>
68
+ <li>Built on Gradio + Spaces</li>
69
+ <li>Demo video + social post</li>
70
+ </ol>
71
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  </div>
73
+ <div class="bsh-dates">
74
+ <div class="bsh-title">✦ Trail Map · Key Dates</div>
75
+ <div class="bsh-dates-grid">
76
+ <div>📅 <b>Reg closes:</b> Wed, June 3 · 23:59 UTC</div>
77
+ <div>🎟️ <b>Credits:</b> Thu, June 4</div>
78
+ <div>🚀 <b>Hack opens:</b> Fri, June 5 · 00:01 UTC</div>
79
+ <div>🏁 <b>Submit by:</b> Mon, June 15 · 23:59 UTC</div>
80
+ </div>
81
+ <div class="bsh-warn">⛔ No registrations accepted once the event starts. Lock it in before June 3!</div>
 
 
 
 
82
  </div>
83
+ <div class="bsh-counter">
84
+ <div class="bsh-counter-title">⏳ Registration closes in</div>
85
+ <div class="bsh-counter-target">June 3, 2026 · 23:59 UTC</div>
86
+ <div class="bsh-nums">
87
+ <div class="bsh-unit"><span class="bsh-num" id="bsh-days">--</span><span class="bsh-lbl">Days</span></div>
88
+ <div class="bsh-unit"><span class="bsh-num" id="bsh-hours">--</span><span class="bsh-lbl">Hrs</span></div>
89
+ <div class="bsh-unit"><span class="bsh-num" id="bsh-mins">--</span><span class="bsh-lbl">Min</span></div>
90
+ <div class="bsh-unit"><span class="bsh-num" id="bsh-secs">--</span><span class="bsh-lbl">Sec</span></div>
91
+ </div>
 
92
  </div>
93
  </div>
94
  </div>
 
288
 
289
  result = f"""
290
  ## ✅ Registration Confirmed!
 
291
  **Participant Details:**
292
  - **Full Name:** {registration['full_name']}
293
  - **Email:** {registration['email']}
294
  - **Hugging Face Username:** {registration['hf_username']}
295
  - **Registered On:** {reg_date}
 
296
  **Hackathon Participation:**
297
  - **Track Interest:** {registration['track_interest']}
298
  - **Hackathon Experience:** {prev}
299
  - **Experience Level:** {registration['experience_level']}
300
  - **Gradio Usage:** {registration['gradio_usage']}
301
  - **How You Heard:** {registration['how_heard']}
 
302
  **Build Small Plans:**
303
  - **Small Model You Plan to Use:** {planned_model_str}
304
  - **Bonus Quests of Interest:** {quests_str}
 
305
  **Project Idea:**
306
  {registration['project_description'] if registration['project_description'] else '_No project description provided_'}
 
307
  ---
308
  **Next Steps:**
309
  - 🎟️ API & compute credits will be assigned on **Thu, May 28, 2026**
 
378
  return f"❌ Registration failed: {message}"
379
 
380
  return f"""✅ Registration Successful!
 
381
  Thank you, **{full_name}**! Your spot is locked in.
 
382
  🎟️ Credits assigned **Thu, May 28** · 🚀 Hack opens **Fri, May 29** · 🏁 Submissions due **Mon, Jun 8**.<br>
383
  💬 Join the Gradio Discord channel `{DISCORD_CHANNEL}`: {DISCORD_INVITE}<br>
384
  📧 Watch your email for credits and updates.
 
385
  **See you in the woods! 🍄🪵**"""
386
 
387
 
 
451
  --bsh-link: #9bc466;
452
  }
453
 
454
+ /* ---------- Hero grid: banner left, info cards right ----------
455
+ Right column is a 3-row flex stack:
456
+ Row 1: Two Tracks + Three Rules (side-by-side 2-col subgrid)
457
+ Row 2: Trail Map · Key Dates (full width)
458
+ Row 3: Registration countdown (full width)
459
+ align-items: stretch makes the right column take the banner's natural
460
+ height; flex: 1 on each row distributes that height evenly. */
461
+ .bsh-hero-grid {
462
+ display: grid;
463
+ grid-template-columns: 1.55fr 1fr;
464
+ gap: 12px;
465
+ margin-bottom: 14px;
466
+ align-items: stretch;
467
+ }
468
+
469
  .bsh-banner-img {
470
+ margin: 0;
471
  border-radius: 14px;
472
  overflow: hidden;
473
  border: 1px solid var(--bsh-card-border);
 
480
  height: auto;
481
  }
482
 
483
+ .bsh-hero-side {
484
+ display: flex;
485
+ flex-direction: column;
486
+ gap: 6px;
487
+ min-width: 0; /* lets the column shrink properly inside the grid */
488
+ height: 100%; /* fill the grid cell so the rows have room to stretch */
489
+ }
490
+
491
+ /* Each row claims an equal share of the available column height. */
492
+ .bsh-hero-side > * {
493
+ flex: 1 1 0;
494
+ min-height: 0;
495
+ }
496
+
497
+ /* Row 1: pair of short cards (Two Tracks | Three Rules) side-by-side. */
498
+ .bsh-hero-pair {
499
  display: grid;
500
+ grid-template-columns: 1fr 1fr;
501
+ gap: 6px;
502
+ }
503
+ .bsh-hero-pair > .bsh-card {
504
+ /* Grid stretches the cards to fill the row height by default. */
505
+ min-width: 0;
506
+ }
507
+
508
+ /* Safety net: clip anything that would visually leak past the card edge.
509
+ With 3 rows the content now fits comfortably, but this guards against
510
+ future copy edits making a card taller than its slot. */
511
+ .bsh-hero-side .bsh-card,
512
+ .bsh-hero-side .bsh-dates,
513
+ .bsh-hero-side .bsh-counter {
514
+ overflow: hidden;
515
+ }
516
+
517
+ /* Compact card/text sizing for the right column. With 3 rows instead of
518
+ 4 each row gets ~35% more height, so we can be less aggressive than
519
+ the previous pass. */
520
+ .bsh-hero-side .bsh-card,
521
+ .bsh-hero-side .bsh-dates {
522
+ padding: 8px 11px;
523
  }
524
+ .bsh-hero-side .bsh-counter {
525
+ padding: 7px 11px;
526
+ }
527
+ .bsh-hero-side .bsh-title {
528
+ margin-bottom: 4px;
529
+ font-size: 10px;
530
+ letter-spacing: 1.2px;
531
+ }
532
+ .bsh-hero-side .bsh-content,
533
+ .bsh-hero-side .bsh-rules li {
534
+ font-size: 11.5px;
535
+ line-height: 1.4;
536
+ }
537
+ .bsh-hero-side .bsh-track {
538
+ margin-top: 2px;
539
+ gap: 6px;
540
+ }
541
+ .bsh-hero-side .bsh-emoji {
542
+ font-size: 13px;
543
+ }
544
+ .bsh-hero-side .bsh-track-name {
545
+ font-size: 12px;
546
+ }
547
+ .bsh-hero-side .bsh-track-desc {
548
+ font-size: 10.5px;
549
+ padding-left: 19px;
550
+ margin-bottom: 1px;
551
+ line-height: 1.3;
552
+ }
553
+ .bsh-hero-side .bsh-rules {
554
+ padding-left: 15px !important;
555
+ }
556
+ .bsh-hero-side .bsh-rules li {
557
+ line-height: 1.45;
558
+ }
559
+ .bsh-hero-side .bsh-dates-grid {
560
+ font-size: 11px;
561
+ gap: 3px 10px;
562
+ }
563
+ .bsh-hero-side .bsh-warn {
564
+ margin-top: 4px;
565
+ padding: 3px 7px;
566
+ font-size: 10px;
567
+ }
568
+ .bsh-hero-side .bsh-counter-title {
569
+ font-size: 10px;
570
+ margin-bottom: 1px;
571
+ }
572
+ .bsh-hero-side .bsh-counter-target {
573
+ font-size: 9px;
574
+ margin-bottom: 3px;
575
+ }
576
+ .bsh-hero-side .bsh-num {
577
+ font-size: 19px;
578
+ }
579
+ .bsh-hero-side .bsh-lbl {
580
+ font-size: 8px;
581
+ margin-top: 1px;
582
+ }
583
+
584
+ /* ---------- Card base styles (shared by old + new layouts) ---------- */
585
  .bsh-card {
586
  background: var(--bsh-card-bg);
587
  border: 1px solid var(--bsh-card-border);
 
632
  line-height: 1.7;
633
  color: var(--bsh-text);
634
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
635
 
636
+ /* ---------- Dates card ---------- */
 
 
 
 
 
 
637
  .bsh-dates {
638
  background: var(--bsh-card-bg);
639
  border: 1px solid var(--bsh-card-border);
 
660
  font-weight: 600;
661
  text-align: center;
662
  }
663
+
664
+ /* ---------- Countdown card ---------- */
665
  .bsh-counter {
666
  background: var(--bsh-counter-bg);
667
  border: 1px solid var(--bsh-card-border);
 
713
  text-transform: uppercase;
714
  }
715
 
716
+ /* ---------- Discord ribbon ---------- */
717
  .bsh-discord {
718
  margin-top: 14px;
719
  background: var(--bsh-discord-bg);
 
738
  color: var(--bsh-text);
739
  }
740
 
741
+ /* ---------- Buttons ---------- */
742
  #submit-btn {
743
  background: linear-gradient(135deg, #4a7c2e 0%, #2d5016 100%) !important;
744
  border: 1px solid #6b4423 !important;
 
770
  background: #7d5430 !important;
771
  }
772
 
773
+ /* ---------- Responsive: collapse the hero grid on narrow screens ---------- */
774
  @media (max-width: 760px) {
775
+ .bsh-hero-grid { grid-template-columns: 1fr; }
 
776
  }
777
  """
778
 
 
783
  theme=gr.themes.Soft(primary_hue="green", secondary_hue="amber", neutral_hue="stone"),
784
  ) as demo:
785
 
786
+ gr.HTML(HERO_HTML)
 
 
787
 
788
  with gr.Tabs():
789
  with gr.Tab("📝 Register"):
 
981
  - Use the **exact** email and username you registered with
982
  - Both fields are case-insensitive but must match
983
  - Registration is open until **Wed, May 27, 2026 · 23:59 UTC** — once it closes, no new entries can be added
 
984
  **Support:**
985
  - Discord: [{DISCORD_INVITE}]({DISCORD_INVITE}) (channel `{DISCORD_CHANNEL}`)
986
  - Email: gradio-team@huggingface.co
 
1005
 
1006
 
1007
  if __name__ == "__main__":
1008
+ demo.launch(allowed_paths=["."])