Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import json
|
| 3 |
from datetime import datetime
|
| 4 |
-
from datasets import Dataset
|
| 5 |
from huggingface_hub import login, HfApi
|
| 6 |
import pandas as pd
|
| 7 |
import os
|
|
@@ -377,6 +377,99 @@ def safe_add_to_dataset(registration_data, max_retries=5, retry_delay=3):
|
|
| 377 |
traceback.print_exc()
|
| 378 |
return False, f"β Registration failed: {str(e)}"
|
| 379 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 380 |
def submit_registration(full_name, email, hf_username, gradio_usage,
|
| 381 |
track_interest, previous_participation, experience_level, how_heard,
|
| 382 |
acknowledgment, project_description):
|
|
@@ -447,7 +540,7 @@ def submit_registration(full_name, email, hf_username, gradio_usage,
|
|
| 447 |
Thank you, {full_name}! Your registration has been received and saved.<br>
|
| 448 |
π§ You will receive information about API credits as we finalize sponsor partnerships.<br>
|
| 449 |
π API and Compute credits will be distributed before or during the Hackathon starting date.<br>
|
| 450 |
-
π¬ Be sure to **join the Huggingface organization** for regular updates on the hackathon and **to submit your entries**. Join our Discord community channel `agents-mcp-hackathon-winter25π` for updates and support during the event: https://discord.gg/
|
| 451 |
**See you at the hackathon! π**"""
|
| 452 |
|
| 453 |
# Health check function
|
|
@@ -488,7 +581,6 @@ custom_css = """
|
|
| 488 |
-webkit-text-fill-color: transparent;
|
| 489 |
background-clip: text;
|
| 490 |
}
|
| 491 |
-
|
| 492 |
/* Gradient Submit Button Styling */
|
| 493 |
#gradient-submit-btn {
|
| 494 |
background: linear-gradient(135deg, #0a0a0a 0%, #FF7A00 35%, #4A90E2 70%, #ffffff 100%) !important;
|
|
@@ -502,23 +594,36 @@ custom_css = """
|
|
| 502 |
transition: all 0.3s ease !important;
|
| 503 |
text-transform: none !important;
|
| 504 |
}
|
| 505 |
-
|
| 506 |
#gradient-submit-btn:hover {
|
| 507 |
transform: translateY(-2px) !important;
|
| 508 |
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25) !important;
|
| 509 |
}
|
| 510 |
-
|
| 511 |
#gradient-submit-btn:active {
|
| 512 |
transform: translateY(0px) !important;
|
| 513 |
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
|
| 514 |
}
|
| 515 |
-
|
| 516 |
/* Disabled state for the button */
|
| 517 |
#gradient-submit-btn:disabled {
|
| 518 |
opacity: 0.6 !important;
|
| 519 |
cursor: not-allowed !important;
|
| 520 |
transform: none !important;
|
| 521 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 522 |
"""
|
| 523 |
|
| 524 |
# Create the Gradio interface
|
|
@@ -527,7 +632,7 @@ with gr.Blocks(title="Gradio Agents & MCP Hackathon - Winter 2025", css=custom_c
|
|
| 527 |
# Header
|
| 528 |
gr.Markdown("""
|
| 529 |
# π€ Gradio Agents & MCP Hackathon - Winter 2025 Registration π
|
| 530 |
-
**Join our [Discord Community](https://discord.gg/
|
| 531 |
**NOTE: If the registration app says you are registered, then that information is correct and you don't need to send us anything else. NO CONFIRMATION EMAILS ARE SENT FROM OUR SIDE.**
|
| 532 |
|
| 533 |
**π
Event Dates:** November 14-30, 2025 (17 days, 3 weekends) | **π Prizes: $15,000+ USD in cash prizes** | **π» Location:** Online & Global
|
|
@@ -542,151 +647,199 @@ with gr.Blocks(title="Gradio Agents & MCP Hackathon - Winter 2025", css=custom_c
|
|
| 542 |
gr.HTML(COUNTER)
|
| 543 |
gr.Markdown("---")
|
| 544 |
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
|
| 554 |
-
|
| 555 |
-
|
| 556 |
-
|
| 557 |
-
|
| 558 |
-
|
| 559 |
-
|
| 560 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 561 |
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 567 |
|
| 568 |
-
#
|
| 569 |
-
|
| 570 |
-
|
| 571 |
-
|
| 572 |
-
|
| 573 |
-
|
| 574 |
-
|
| 575 |
-
|
| 576 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 577 |
],
|
| 578 |
-
|
|
|
|
| 579 |
)
|
| 580 |
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
gr.Markdown("
|
|
|
|
| 584 |
|
| 585 |
-
|
| 586 |
-
label="Which track interests you most? *",
|
| 587 |
-
choices=[
|
| 588 |
-
"Track 1: MCP Tools & Servers",
|
| 589 |
-
"Track 2: Agentic Applications",
|
| 590 |
-
]
|
| 591 |
-
)
|
| 592 |
|
| 593 |
-
|
| 594 |
-
|
| 595 |
-
label="Hackathon experience *",
|
| 596 |
-
choices=[
|
| 597 |
-
"I participated in June 2025 Agents & MCP Hackathon",
|
| 598 |
-
"I've done other AI hackathons before",
|
| 599 |
-
"This is my first AI hackathon"
|
| 600 |
-
]
|
| 601 |
-
)
|
| 602 |
|
| 603 |
-
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
|
| 618 |
-
|
| 619 |
-
|
| 620 |
-
"
|
| 621 |
-
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
| 625 |
-
|
| 626 |
-
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
with gr.Row():
|
| 632 |
-
with gr.Column():
|
| 633 |
-
# Additional Information Section
|
| 634 |
-
gr.Markdown("## 3. Additional Information")
|
| 635 |
|
| 636 |
-
|
| 637 |
-
label="What type of project are you most excited to build?",
|
| 638 |
-
placeholder="Brief description of your project idea or what interests you most",
|
| 639 |
-
lines=3
|
| 640 |
-
)
|
| 641 |
-
|
| 642 |
-
with gr.Column():
|
| 643 |
-
# Acknowledgment Section
|
| 644 |
-
gr.Markdown("## 4. Acknowledgment")
|
| 645 |
|
| 646 |
-
|
| 647 |
-
|
| 648 |
-
|
|
|
|
|
|
|
| 649 |
)
|
| 650 |
-
|
| 651 |
-
# Submit button
|
| 652 |
-
submit_btn = gr.Button("π Register for Hackathon", variant="primary", size="lg", elem_id="gradient-submit-btn")
|
| 653 |
-
|
| 654 |
-
# Output
|
| 655 |
-
output = gr.Markdown()
|
| 656 |
-
|
| 657 |
-
# Enhanced submit function
|
| 658 |
-
def handle_registration_with_state(*args):
|
| 659 |
-
try:
|
| 660 |
-
result = submit_registration(*args)
|
| 661 |
-
return result, gr.Button("π Register for Hackathon", interactive=True, variant="primary")
|
| 662 |
-
except Exception as e:
|
| 663 |
-
logger.error(f"Registration handling error: {e}")
|
| 664 |
-
return f"β An unexpected error occurred: {str(e)}", gr.Button("π Register for Hackathon", interactive=True, variant="primary")
|
| 665 |
-
|
| 666 |
-
# Click event with updated inputs
|
| 667 |
-
submit_btn.click(
|
| 668 |
-
fn=lambda *args: (gr.Button("β³ Processing Registration...", interactive=False, variant="secondary"), ""),
|
| 669 |
-
inputs=[
|
| 670 |
-
full_name, email, hf_username, gradio_usage,
|
| 671 |
-
track_interest, previous_participation, experience_level, how_heard,
|
| 672 |
-
acknowledgment, project_description,
|
| 673 |
-
],
|
| 674 |
-
outputs=[submit_btn, output],
|
| 675 |
-
queue=False
|
| 676 |
-
).then(
|
| 677 |
-
fn=handle_registration_with_state,
|
| 678 |
-
inputs=[
|
| 679 |
-
full_name, email, hf_username, gradio_usage,
|
| 680 |
-
track_interest, previous_participation, experience_level, how_heard,
|
| 681 |
-
acknowledgment, project_description,
|
| 682 |
-
],
|
| 683 |
-
outputs=[output, submit_btn],
|
| 684 |
-
queue=True
|
| 685 |
-
)
|
| 686 |
|
| 687 |
# Footer
|
| 688 |
gr.Markdown("""
|
| 689 |
-
**Questions?** Join Huggingface [Discord](https://discord.gg/
|
| 690 |
""")
|
| 691 |
|
| 692 |
if __name__ == "__main__":
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import json
|
| 3 |
from datetime import datetime
|
| 4 |
+
from datasets import Dataset, load_dataset
|
| 5 |
from huggingface_hub import login, HfApi
|
| 6 |
import pandas as pd
|
| 7 |
import os
|
|
|
|
| 377 |
traceback.print_exc()
|
| 378 |
return False, f"β Registration failed: {str(e)}"
|
| 379 |
|
| 380 |
+
def verify_registration(email, hf_username):
|
| 381 |
+
"""
|
| 382 |
+
Verify if a user is registered by checking both email and HF username
|
| 383 |
+
Returns registration details if both match
|
| 384 |
+
"""
|
| 385 |
+
try:
|
| 386 |
+
# Validate inputs
|
| 387 |
+
if not email or not email.strip():
|
| 388 |
+
return "β Please enter your email address"
|
| 389 |
+
|
| 390 |
+
if not hf_username or not hf_username.strip():
|
| 391 |
+
return "β Please enter your Hugging Face username"
|
| 392 |
+
|
| 393 |
+
logger.info(f"Verification attempt for email: {email}")
|
| 394 |
+
|
| 395 |
+
# Load dataset
|
| 396 |
+
try:
|
| 397 |
+
dataset = load_dataset(DATASET_NAME, split="train")
|
| 398 |
+
df = dataset.to_pandas()
|
| 399 |
+
logger.info(f"Loaded dataset with {len(df)} registrations")
|
| 400 |
+
except Exception as load_error:
|
| 401 |
+
logger.error(f"Failed to load dataset: {load_error}")
|
| 402 |
+
return "β Unable to verify registration at this time. Please try again later."
|
| 403 |
+
|
| 404 |
+
# Search for exact match (both email AND username must match)
|
| 405 |
+
email_lower = email.strip().lower()
|
| 406 |
+
username_lower = hf_username.strip().lower()
|
| 407 |
+
|
| 408 |
+
match = df[
|
| 409 |
+
(df['email'].str.lower() == email_lower) &
|
| 410 |
+
(df['hf_username'].str.lower() == username_lower)
|
| 411 |
+
]
|
| 412 |
+
|
| 413 |
+
if len(match) == 0:
|
| 414 |
+
# Check if email exists with different username
|
| 415 |
+
email_exists = df[df['email'].str.lower() == email_lower]
|
| 416 |
+
username_exists = df[df['hf_username'].str.lower() == username_lower]
|
| 417 |
+
|
| 418 |
+
if len(email_exists) > 0 and len(username_exists) == 0:
|
| 419 |
+
return "β Email found but Hugging Face username doesn't match. Please check your username."
|
| 420 |
+
elif len(username_exists) > 0 and len(email_exists) == 0:
|
| 421 |
+
return "β Hugging Face username found but email doesn't match. Please check your email."
|
| 422 |
+
else:
|
| 423 |
+
return "β No registration found with this email and Hugging Face username combination."
|
| 424 |
+
|
| 425 |
+
# Registration found - format the details
|
| 426 |
+
registration = match.iloc[0]
|
| 427 |
+
|
| 428 |
+
# Parse timestamp
|
| 429 |
+
try:
|
| 430 |
+
timestamp = pd.to_datetime(registration['timestamp'])
|
| 431 |
+
reg_date = timestamp.strftime("%B %d, %Y at %I:%M %p UTC")
|
| 432 |
+
except:
|
| 433 |
+
reg_date = registration['timestamp']
|
| 434 |
+
|
| 435 |
+
# Format track interests
|
| 436 |
+
track_interest = registration['track_interest']
|
| 437 |
+
if isinstance(track_interest, str):
|
| 438 |
+
# Clean up the string representation of list
|
| 439 |
+
track_interest = track_interest.strip("[]'\"").replace("'", "")
|
| 440 |
+
|
| 441 |
+
result = f"""
|
| 442 |
+
## β
Registration Confirmed!
|
| 443 |
+
**Participant Details:**
|
| 444 |
+
- **Full Name:** {registration['full_name']}
|
| 445 |
+
- **Email:** {registration['email']}
|
| 446 |
+
- **Hugging Face Username:** {registration['hf_username']}
|
| 447 |
+
- **Registered On:** {reg_date}
|
| 448 |
+
**Hackathon Participation:**
|
| 449 |
+
- **Track Interest:** {track_interest}
|
| 450 |
+
- **Gradio Usage:** {registration['gradio_usage']}
|
| 451 |
+
- **Previous Participation:** {registration['previous_participation']}
|
| 452 |
+
- **Experience Level:** {registration['experience_level']}
|
| 453 |
+
- **How You Heard:** {registration['how_heard']}
|
| 454 |
+
**Project Idea:**
|
| 455 |
+
{registration['project_description'] if registration['project_description'] else '_No project description provided_'}
|
| 456 |
+
---
|
| 457 |
+
**Next Steps:**
|
| 458 |
+
- π API and Compute credits will be distributed before or during the hackathon
|
| 459 |
+
- π¬ Join our Discord community channel `agents-mcp-hackathon-winter25π`: https://discord.gg/92sEPT2Zhv
|
| 460 |
+
- π§ Watch your email for important updates
|
| 461 |
+
- π Start planning your project!
|
| 462 |
+
"""
|
| 463 |
+
|
| 464 |
+
logger.info(f"β
Verification successful for {email}")
|
| 465 |
+
return result
|
| 466 |
+
|
| 467 |
+
except Exception as e:
|
| 468 |
+
logger.error(f"Error during verification: {e}")
|
| 469 |
+
import traceback
|
| 470 |
+
traceback.print_exc()
|
| 471 |
+
return f"β An error occurred during verification: {str(e)}"
|
| 472 |
+
|
| 473 |
def submit_registration(full_name, email, hf_username, gradio_usage,
|
| 474 |
track_interest, previous_participation, experience_level, how_heard,
|
| 475 |
acknowledgment, project_description):
|
|
|
|
| 540 |
Thank you, {full_name}! Your registration has been received and saved.<br>
|
| 541 |
π§ You will receive information about API credits as we finalize sponsor partnerships.<br>
|
| 542 |
π API and Compute credits will be distributed before or during the Hackathon starting date.<br>
|
| 543 |
+
π¬ Be sure to **join the Huggingface organization** for regular updates on the hackathon and **to submit your entries**. Join our Discord community channel `agents-mcp-hackathon-winter25π` for updates and support during the event: https://discord.gg/92sEPT2Zhv
|
| 544 |
**See you at the hackathon! π**"""
|
| 545 |
|
| 546 |
# Health check function
|
|
|
|
| 581 |
-webkit-text-fill-color: transparent;
|
| 582 |
background-clip: text;
|
| 583 |
}
|
|
|
|
| 584 |
/* Gradient Submit Button Styling */
|
| 585 |
#gradient-submit-btn {
|
| 586 |
background: linear-gradient(135deg, #0a0a0a 0%, #FF7A00 35%, #4A90E2 70%, #ffffff 100%) !important;
|
|
|
|
| 594 |
transition: all 0.3s ease !important;
|
| 595 |
text-transform: none !important;
|
| 596 |
}
|
|
|
|
| 597 |
#gradient-submit-btn:hover {
|
| 598 |
transform: translateY(-2px) !important;
|
| 599 |
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25) !important;
|
| 600 |
}
|
|
|
|
| 601 |
#gradient-submit-btn:active {
|
| 602 |
transform: translateY(0px) !important;
|
| 603 |
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
|
| 604 |
}
|
|
|
|
| 605 |
/* Disabled state for the button */
|
| 606 |
#gradient-submit-btn:disabled {
|
| 607 |
opacity: 0.6 !important;
|
| 608 |
cursor: not-allowed !important;
|
| 609 |
transform: none !important;
|
| 610 |
}
|
| 611 |
+
/* Verify button styling */
|
| 612 |
+
#verify-btn {
|
| 613 |
+
background: linear-gradient(135deg, #4A90E2 0%, #0a0a0a 100%) !important;
|
| 614 |
+
border: none !important;
|
| 615 |
+
color: white !important;
|
| 616 |
+
font-weight: 600 !important;
|
| 617 |
+
font-size: 16px !important;
|
| 618 |
+
padding: 12px 24px !important;
|
| 619 |
+
border-radius: 8px !important;
|
| 620 |
+
box-shadow: 0 3px 10px rgba(74, 144, 226, 0.3) !important;
|
| 621 |
+
transition: all 0.3s ease !important;
|
| 622 |
+
}
|
| 623 |
+
#verify-btn:hover {
|
| 624 |
+
transform: translateY(-2px) !important;
|
| 625 |
+
box-shadow: 0 5px 15px rgba(74, 144, 226, 0.4) !important;
|
| 626 |
+
}
|
| 627 |
"""
|
| 628 |
|
| 629 |
# Create the Gradio interface
|
|
|
|
| 632 |
# Header
|
| 633 |
gr.Markdown("""
|
| 634 |
# π€ Gradio Agents & MCP Hackathon - Winter 2025 Registration π
|
| 635 |
+
**Join our [Discord Community](https://discord.gg/92sEPT2Zhv) channel `agents-mcp-hackathon-winter25π` for active support during the hackathon.**
|
| 636 |
**NOTE: If the registration app says you are registered, then that information is correct and you don't need to send us anything else. NO CONFIRMATION EMAILS ARE SENT FROM OUR SIDE.**
|
| 637 |
|
| 638 |
**π
Event Dates:** November 14-30, 2025 (17 days, 3 weekends) | **π Prizes: $15,000+ USD in cash prizes** | **π» Location:** Online & Global
|
|
|
|
| 647 |
gr.HTML(COUNTER)
|
| 648 |
gr.Markdown("---")
|
| 649 |
|
| 650 |
+
# Create tabs
|
| 651 |
+
with gr.Tabs():
|
| 652 |
+
# Registration Tab
|
| 653 |
+
with gr.Tab("π Register"):
|
| 654 |
+
with gr.Row():
|
| 655 |
+
with gr.Column():
|
| 656 |
+
# Personal Information Section
|
| 657 |
+
gr.Markdown("## 1. Personal Information")
|
| 658 |
+
|
| 659 |
+
full_name = gr.Textbox(
|
| 660 |
+
label="Full Name *",
|
| 661 |
+
placeholder="Your full name as you'd like it on certificates",
|
| 662 |
+
max_lines=1
|
| 663 |
+
)
|
| 664 |
+
|
| 665 |
+
email = gr.Textbox(
|
| 666 |
+
label="Email Address *",
|
| 667 |
+
placeholder="Primary contact email (we'll send important updates here)",
|
| 668 |
+
max_lines=1
|
| 669 |
+
)
|
| 670 |
+
|
| 671 |
+
hf_username = gr.Textbox(
|
| 672 |
+
label="Hugging Face Username *",
|
| 673 |
+
placeholder="Required for organization access and submissions",
|
| 674 |
+
max_lines=1
|
| 675 |
+
)
|
| 676 |
+
|
| 677 |
+
gradio_usage = gr.Radio(
|
| 678 |
+
label="How are you currently using Gradio? *",
|
| 679 |
+
choices=[
|
| 680 |
+
"Professional work - My company uses Gradio",
|
| 681 |
+
"Personal projects - Building side projects",
|
| 682 |
+
"Academic/Research - University or research work",
|
| 683 |
+
"Learning - New to Gradio, want to learn",
|
| 684 |
+
"Not using yet - Interested to start"
|
| 685 |
+
],
|
| 686 |
+
info="Helps us understand our community better"
|
| 687 |
+
)
|
| 688 |
+
|
| 689 |
+
with gr.Column():
|
| 690 |
+
# Hackathon Participation Section
|
| 691 |
+
gr.Markdown("## 2. Hackathon Participation")
|
| 692 |
+
|
| 693 |
+
track_interest = gr.CheckboxGroup(
|
| 694 |
+
label="Which track interests you most? *",
|
| 695 |
+
choices=[
|
| 696 |
+
"Track 1: MCP Tools & Servers",
|
| 697 |
+
"Track 2: Agentic Applications",
|
| 698 |
+
]
|
| 699 |
+
)
|
| 700 |
+
|
| 701 |
+
previous_participation = gr.Radio(
|
| 702 |
+
label="Hackathon experience *",
|
| 703 |
+
choices=[
|
| 704 |
+
"I participated in June 2025 Agents & MCP Hackathon",
|
| 705 |
+
"I've done other AI hackathons before",
|
| 706 |
+
"This is my first AI hackathon"
|
| 707 |
+
]
|
| 708 |
+
)
|
| 709 |
+
|
| 710 |
+
experience_level = gr.Radio(
|
| 711 |
+
label="Your experience with AI/Agents development *",
|
| 712 |
+
choices=[
|
| 713 |
+
"Beginner - New to AI development",
|
| 714 |
+
"Intermediate - Some AI projects",
|
| 715 |
+
"Advanced - Regular AI developer",
|
| 716 |
+
"Expert - Professional AI engineer"
|
| 717 |
+
]
|
| 718 |
+
)
|
| 719 |
+
|
| 720 |
+
how_heard = gr.Dropdown(
|
| 721 |
+
label="How did you hear about this hackathon? *",
|
| 722 |
+
choices=[
|
| 723 |
+
"Hugging Face email/newsletter",
|
| 724 |
+
"Twitter/X",
|
| 725 |
+
"LinkedIn",
|
| 726 |
+
"Discord",
|
| 727 |
+
"From a colleague/friend",
|
| 728 |
+
"YouTube",
|
| 729 |
+
"Reddit",
|
| 730 |
+
"Sponsor announcement",
|
| 731 |
+
"I participated in June 2025",
|
| 732 |
+
"Other"
|
| 733 |
+
]
|
| 734 |
+
)
|
| 735 |
+
|
| 736 |
+
with gr.Row():
|
| 737 |
+
with gr.Column():
|
| 738 |
+
# Additional Information Section
|
| 739 |
+
gr.Markdown("## 3. Additional Information")
|
| 740 |
+
|
| 741 |
+
project_description = gr.Textbox(
|
| 742 |
+
label="What type of project are you most excited to build?",
|
| 743 |
+
placeholder="Brief description of your project idea or what interests you most",
|
| 744 |
+
lines=3
|
| 745 |
+
)
|
| 746 |
+
|
| 747 |
+
with gr.Column():
|
| 748 |
+
# Acknowledgment Section
|
| 749 |
+
gr.Markdown("## 4. Acknowledgment")
|
| 750 |
+
|
| 751 |
+
acknowledgment = gr.Checkbox(
|
| 752 |
+
label="Acknowledgment *",
|
| 753 |
+
info="""I commit to actively participate and submit a project by November 30, 2025. I understand that API/compute credits are provided to support hackathon participation and should be used for building my hackathon project. I commit to using these credits responsibly during the event period.""",
|
| 754 |
+
)
|
| 755 |
+
|
| 756 |
+
# Submit button
|
| 757 |
+
submit_btn = gr.Button("π Register for Hackathon", variant="primary", size="lg", elem_id="gradient-submit-btn")
|
| 758 |
|
| 759 |
+
# Output
|
| 760 |
+
output = gr.Markdown()
|
| 761 |
+
|
| 762 |
+
# Enhanced submit function
|
| 763 |
+
def handle_registration_with_state(*args):
|
| 764 |
+
try:
|
| 765 |
+
result = submit_registration(*args)
|
| 766 |
+
return result, gr.Button("π Register for Hackathon", interactive=True, variant="primary")
|
| 767 |
+
except Exception as e:
|
| 768 |
+
logger.error(f"Registration handling error: {e}")
|
| 769 |
+
return f"β An unexpected error occurred: {str(e)}", gr.Button("π Register for Hackathon", interactive=True, variant="primary")
|
| 770 |
|
| 771 |
+
# Click event with updated inputs
|
| 772 |
+
submit_btn.click(
|
| 773 |
+
fn=lambda *args: (gr.Button("β³ Processing Registration...", interactive=False, variant="secondary"), ""),
|
| 774 |
+
inputs=[
|
| 775 |
+
full_name, email, hf_username, gradio_usage,
|
| 776 |
+
track_interest, previous_participation, experience_level, how_heard,
|
| 777 |
+
acknowledgment, project_description,
|
| 778 |
+
],
|
| 779 |
+
outputs=[submit_btn, output],
|
| 780 |
+
queue=False
|
| 781 |
+
).then(
|
| 782 |
+
fn=handle_registration_with_state,
|
| 783 |
+
inputs=[
|
| 784 |
+
full_name, email, hf_username, gradio_usage,
|
| 785 |
+
track_interest, previous_participation, experience_level, how_heard,
|
| 786 |
+
acknowledgment, project_description,
|
| 787 |
],
|
| 788 |
+
outputs=[output, submit_btn],
|
| 789 |
+
queue=True
|
| 790 |
)
|
| 791 |
|
| 792 |
+
# Verification Tab
|
| 793 |
+
with gr.Tab("π Verify Registration"):
|
| 794 |
+
gr.Markdown("""
|
| 795 |
+
## Check Your Registration Status
|
| 796 |
|
| 797 |
+
Enter your email address and Hugging Face username to verify your registration and view your details.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 798 |
|
| 799 |
+
**Note:** Both email and username must match exactly for security purposes.
|
| 800 |
+
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 801 |
|
| 802 |
+
with gr.Row():
|
| 803 |
+
with gr.Column():
|
| 804 |
+
verify_email = gr.Textbox(
|
| 805 |
+
label="Email Address",
|
| 806 |
+
placeholder="Enter your registered email",
|
| 807 |
+
max_lines=1
|
| 808 |
+
)
|
| 809 |
+
|
| 810 |
+
verify_hf_username = gr.Textbox(
|
| 811 |
+
label="Hugging Face Username",
|
| 812 |
+
placeholder="Enter your registered HF username",
|
| 813 |
+
max_lines=1
|
| 814 |
+
)
|
| 815 |
+
|
| 816 |
+
verify_btn = gr.Button("π Check Registration Status", variant="primary", size="lg", elem_id="verify-btn")
|
| 817 |
+
|
| 818 |
+
with gr.Column():
|
| 819 |
+
gr.Markdown("""
|
| 820 |
+
### Need Help?
|
| 821 |
+
|
| 822 |
+
- Make sure you enter the **exact** email and username you used during registration
|
| 823 |
+
- Both fields are **case-insensitive** but must match your registration
|
| 824 |
+
- If you can't find your registration, try registering again or contact support
|
| 825 |
+
|
| 826 |
+
**Support:**
|
| 827 |
+
- Discord: https://discord.gg/92sEPT2Zhv
|
| 828 |
+
- Email: gradio-team@huggingface.co
|
| 829 |
+
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 830 |
|
| 831 |
+
verify_output = gr.Markdown()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 832 |
|
| 833 |
+
# Verification click event
|
| 834 |
+
verify_btn.click(
|
| 835 |
+
fn=verify_registration,
|
| 836 |
+
inputs=[verify_email, verify_hf_username],
|
| 837 |
+
outputs=verify_output
|
| 838 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 839 |
|
| 840 |
# Footer
|
| 841 |
gr.Markdown("""
|
| 842 |
+
**Questions?** Join Huggingface [Discord](https://discord.gg/92sEPT2Zhv) or email: gradio-team@huggingface.co
|
| 843 |
""")
|
| 844 |
|
| 845 |
if __name__ == "__main__":
|