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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 488 |
"""
|
| 489 |
) as demo:
|
| 490 |
|
|
@@ -507,81 +669,92 @@ with gr.Blocks(
|
|
| 507 |
|
| 508 |
# GitHub Star Reminder - Added back!
|
| 509 |
gr.HTML("""
|
| 510 |
-
<div style='background: linear-gradient(135deg, #
|
| 511 |
-
border-radius:
|
| 512 |
-
padding:
|
| 513 |
-
margin:
|
| 514 |
-
box-shadow: 0 8px
|
| 515 |
-
border:
|
| 516 |
-
<div style='text-align: center; color:
|
| 517 |
-
<h3 style='margin: 0 0
|
| 518 |
⭐ Love SpatialTracker? Give us a Star! ⭐
|
| 519 |
</h3>
|
| 520 |
-
<p style='margin: 0 0
|
| 521 |
-
Help us grow by starring our repository on GitHub!
|
| 522 |
</p>
|
| 523 |
<div style='display: flex; justify-content: center;'>
|
| 524 |
<a href="https://github.com/henry123-boy/SpaTrackerV2"
|
| 525 |
target="_blank"
|
| 526 |
style='display: inline-flex;
|
| 527 |
align-items: center;
|
| 528 |
-
gap:
|
| 529 |
-
background: rgba(
|
| 530 |
-
color:
|
| 531 |
-
padding:
|
| 532 |
-
border-radius:
|
| 533 |
text-decoration: none;
|
| 534 |
font-weight: bold;
|
| 535 |
-
font-size:
|
| 536 |
-
backdrop-filter: blur(
|
| 537 |
-
border: 1px solid rgba(
|
| 538 |
transition: all 0.3s ease;'
|
| 539 |
-
onmouseover="this.style.background='rgba(
|
| 540 |
-
onmouseout="this.style.background='rgba(
|
| 541 |
-
<span style='font-size:
|
| 542 |
Star on GitHub
|
| 543 |
</a>
|
| 544 |
</div>
|
| 545 |
-
<p style='margin: 15px 0 0 0; font-size: 14px; opacity: 0.8;'>
|
| 546 |
-
🎉 Thank you for being part of our community! 🎉
|
| 547 |
-
</p>
|
| 548 |
</div>
|
| 549 |
</div>
|
| 550 |
""")
|
| 551 |
|
| 552 |
# Example videos section - moved to top
|
| 553 |
-
with gr.Group():
|
| 554 |
gr.Markdown("### 📂 Example Videos")
|
| 555 |
gr.Markdown("Try these example videos to get started quickly:")
|
| 556 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 557 |
# Define video_input here so it can be referenced in examples
|
| 558 |
video_input = gr.Video(
|
| 559 |
label="Upload Video or Select Example",
|
| 560 |
-
format="mp4"
|
|
|
|
| 561 |
)
|
| 562 |
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
[
|
| 567 |
-
|
| 568 |
-
|
| 569 |
-
|
| 570 |
-
|
| 571 |
-
|
| 572 |
-
|
| 573 |
-
|
| 574 |
-
|
| 575 |
-
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
|
|
|
|
|
|
|
|
|
| 585 |
|
| 586 |
with gr.Row():
|
| 587 |
with gr.Column(scale=1):
|
|
@@ -614,7 +787,8 @@ with gr.Blocks(
|
|
| 614 |
gr.Markdown("### 🎬 Tracking Results")
|
| 615 |
tracking_result_video = gr.Video(
|
| 616 |
label="Tracking Result Video",
|
| 617 |
-
interactive=False
|
|
|
|
| 618 |
)
|
| 619 |
|
| 620 |
# 3D Visualization
|
|
|
|
| 485 |
padding: 20px;
|
| 486 |
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
| 487 |
}
|
| 488 |
+
/* 固定视频上传组件高度 */
|
| 489 |
+
.gr-video {
|
| 490 |
+
height: 300px !important;
|
| 491 |
+
min-height: 300px !important;
|
| 492 |
+
max-height: 300px !important;
|
| 493 |
+
}
|
| 494 |
+
.gr-video video {
|
| 495 |
+
height: 260px !important;
|
| 496 |
+
max-height: 260px !important;
|
| 497 |
+
object-fit: contain !important;
|
| 498 |
+
background: #f8f9fa;
|
| 499 |
+
}
|
| 500 |
+
.gr-video .gr-video-player {
|
| 501 |
+
height: 260px !important;
|
| 502 |
+
max-height: 260px !important;
|
| 503 |
+
}
|
| 504 |
+
/* 水平滚动的示例视频样式 */
|
| 505 |
+
.example-videos .gr-examples {
|
| 506 |
+
overflow: visible !important;
|
| 507 |
+
}
|
| 508 |
+
.example-videos .gr-examples .gr-table-wrapper {
|
| 509 |
+
overflow-x: auto !important;
|
| 510 |
+
overflow-y: hidden !important;
|
| 511 |
+
scrollbar-width: thin;
|
| 512 |
+
scrollbar-color: #667eea #f1f1f1;
|
| 513 |
+
}
|
| 514 |
+
.example-videos .gr-examples .gr-table-wrapper::-webkit-scrollbar {
|
| 515 |
+
height: 8px;
|
| 516 |
+
}
|
| 517 |
+
.example-videos .gr-examples .gr-table-wrapper::-webkit-scrollbar-track {
|
| 518 |
+
background: #f1f1f1;
|
| 519 |
+
border-radius: 4px;
|
| 520 |
+
}
|
| 521 |
+
.example-videos .gr-examples .gr-table-wrapper::-webkit-scrollbar-thumb {
|
| 522 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 523 |
+
border-radius: 4px;
|
| 524 |
+
}
|
| 525 |
+
.example-videos .gr-examples .gr-table-wrapper::-webkit-scrollbar-thumb:hover {
|
| 526 |
+
background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
|
| 527 |
+
}
|
| 528 |
+
.example-videos .gr-examples .gr-table {
|
| 529 |
+
display: flex !important;
|
| 530 |
+
flex-wrap: nowrap !important;
|
| 531 |
+
min-width: max-content !important;
|
| 532 |
+
gap: 10px !important;
|
| 533 |
+
}
|
| 534 |
+
.example-videos .gr-examples .gr-table tbody {
|
| 535 |
+
display: flex !important;
|
| 536 |
+
flex-direction: row !important;
|
| 537 |
+
flex-wrap: nowrap !important;
|
| 538 |
+
gap: 10px !important;
|
| 539 |
+
}
|
| 540 |
+
.example-videos .gr-examples .gr-table tbody tr {
|
| 541 |
+
display: flex !important;
|
| 542 |
+
flex-direction: column !important;
|
| 543 |
+
min-width: 120px !important;
|
| 544 |
+
max-width: 120px !important;
|
| 545 |
+
margin: 0 !important;
|
| 546 |
+
background: white;
|
| 547 |
+
border-radius: 8px;
|
| 548 |
+
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
| 549 |
+
transition: all 0.3s ease;
|
| 550 |
+
cursor: pointer;
|
| 551 |
+
}
|
| 552 |
+
.example-videos .gr-examples .gr-table tbody tr:hover {
|
| 553 |
+
transform: translateY(-2px);
|
| 554 |
+
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
|
| 555 |
+
}
|
| 556 |
+
.example-videos .gr-examples .gr-table tbody tr td {
|
| 557 |
+
text-align: center !important;
|
| 558 |
+
padding: 8px !important;
|
| 559 |
+
border: none !important;
|
| 560 |
+
}
|
| 561 |
+
.example-videos .gr-examples .gr-table tbody tr td video {
|
| 562 |
+
border-radius: 6px !important;
|
| 563 |
+
width: 100% !important;
|
| 564 |
+
height: auto !important;
|
| 565 |
+
}
|
| 566 |
+
.example-videos .gr-examples .gr-table tbody tr td:last-child {
|
| 567 |
+
font-size: 12px !important;
|
| 568 |
+
font-weight: 500 !important;
|
| 569 |
+
color: #333 !important;
|
| 570 |
+
padding-top: 4px !important;
|
| 571 |
+
}
|
| 572 |
+
|
| 573 |
+
/* 新的水平滚动示例视频样式 */
|
| 574 |
+
.horizontal-examples .gr-examples {
|
| 575 |
+
overflow: visible !important;
|
| 576 |
+
}
|
| 577 |
+
.horizontal-examples .gr-examples .gr-table-wrapper {
|
| 578 |
+
overflow-x: auto !important;
|
| 579 |
+
overflow-y: hidden !important;
|
| 580 |
+
scrollbar-width: thin;
|
| 581 |
+
scrollbar-color: #667eea #f1f1f1;
|
| 582 |
+
padding: 10px 0;
|
| 583 |
+
}
|
| 584 |
+
.horizontal-examples .gr-examples .gr-table-wrapper::-webkit-scrollbar {
|
| 585 |
+
height: 8px;
|
| 586 |
+
}
|
| 587 |
+
.horizontal-examples .gr-examples .gr-table-wrapper::-webkit-scrollbar-track {
|
| 588 |
+
background: #f1f1f1;
|
| 589 |
+
border-radius: 4px;
|
| 590 |
+
}
|
| 591 |
+
.horizontal-examples .gr-examples .gr-table-wrapper::-webkit-scrollbar-thumb {
|
| 592 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 593 |
+
border-radius: 4px;
|
| 594 |
+
}
|
| 595 |
+
.horizontal-examples .gr-examples .gr-table-wrapper::-webkit-scrollbar-thumb:hover {
|
| 596 |
+
background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
|
| 597 |
+
}
|
| 598 |
+
.horizontal-examples .gr-examples .gr-table {
|
| 599 |
+
display: flex !important;
|
| 600 |
+
flex-wrap: nowrap !important;
|
| 601 |
+
min-width: max-content !important;
|
| 602 |
+
gap: 15px !important;
|
| 603 |
+
padding-bottom: 10px;
|
| 604 |
+
}
|
| 605 |
+
.horizontal-examples .gr-examples .gr-table tbody {
|
| 606 |
+
display: flex !important;
|
| 607 |
+
flex-direction: row !important;
|
| 608 |
+
flex-wrap: nowrap !important;
|
| 609 |
+
gap: 15px !important;
|
| 610 |
+
}
|
| 611 |
+
.horizontal-examples .gr-examples .gr-table tbody tr {
|
| 612 |
+
display: flex !important;
|
| 613 |
+
flex-direction: column !important;
|
| 614 |
+
min-width: 160px !important;
|
| 615 |
+
max-width: 160px !important;
|
| 616 |
+
margin: 0 !important;
|
| 617 |
+
background: white;
|
| 618 |
+
border-radius: 12px;
|
| 619 |
+
box-shadow: 0 3px 12px rgba(0,0,0,0.12);
|
| 620 |
+
transition: all 0.3s ease;
|
| 621 |
+
cursor: pointer;
|
| 622 |
+
overflow: hidden;
|
| 623 |
+
}
|
| 624 |
+
.horizontal-examples .gr-examples .gr-table tbody tr:hover {
|
| 625 |
+
transform: translateY(-4px);
|
| 626 |
+
box-shadow: 0 8px 20px rgba(102, 126, 234, 0.25);
|
| 627 |
+
}
|
| 628 |
+
.horizontal-examples .gr-examples .gr-table tbody tr td {
|
| 629 |
+
text-align: center !important;
|
| 630 |
+
padding: 0 !important;
|
| 631 |
+
border: none !important;
|
| 632 |
+
}
|
| 633 |
+
.horizontal-examples .gr-examples .gr-table tbody tr td:first-child {
|
| 634 |
+
padding: 0 !important;
|
| 635 |
+
}
|
| 636 |
+
.horizontal-examples .gr-examples .gr-table tbody tr td video {
|
| 637 |
+
border-radius: 8px 8px 0 0 !important;
|
| 638 |
+
width: 100% !important;
|
| 639 |
+
height: 90px !important;
|
| 640 |
+
object-fit: cover !important;
|
| 641 |
+
}
|
| 642 |
+
.horizontal-examples .gr-examples .gr-table tbody tr td:last-child {
|
| 643 |
+
font-size: 11px !important;
|
| 644 |
+
font-weight: 600 !important;
|
| 645 |
+
color: #333 !important;
|
| 646 |
+
padding: 8px 12px !important;
|
| 647 |
+
background: linear-gradient(135deg, #f8f9ff 0%, #e6f3ff 100%);
|
| 648 |
+
border-radius: 0 0 8px 8px;
|
| 649 |
+
}
|
| 650 |
"""
|
| 651 |
) as demo:
|
| 652 |
|
|
|
|
| 669 |
|
| 670 |
# GitHub Star Reminder - Added back!
|
| 671 |
gr.HTML("""
|
| 672 |
+
<div style='background: linear-gradient(135deg, #e8eaff 0%, #f0f2ff 100%);
|
| 673 |
+
border-radius: 10px;
|
| 674 |
+
padding: 15px;
|
| 675 |
+
margin: 15px 0;
|
| 676 |
+
box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
|
| 677 |
+
border: 1px solid rgba(102, 126, 234, 0.15);'>
|
| 678 |
+
<div style='text-align: center; color: #4a5568;'>
|
| 679 |
+
<h3 style='margin: 0 0 10px 0; font-size: 18px; text-shadow: none; color: #2d3748;'>
|
| 680 |
⭐ Love SpatialTracker? Give us a Star! ⭐
|
| 681 |
</h3>
|
| 682 |
+
<p style='margin: 0 0 12px 0; font-size: 14px; opacity: 0.8; color: #4a5568;'>
|
| 683 |
+
Help us grow by starring our repository on GitHub! 🚀
|
| 684 |
</p>
|
| 685 |
<div style='display: flex; justify-content: center;'>
|
| 686 |
<a href="https://github.com/henry123-boy/SpaTrackerV2"
|
| 687 |
target="_blank"
|
| 688 |
style='display: inline-flex;
|
| 689 |
align-items: center;
|
| 690 |
+
gap: 6px;
|
| 691 |
+
background: rgba(102, 126, 234, 0.1);
|
| 692 |
+
color: #4a5568;
|
| 693 |
+
padding: 8px 16px;
|
| 694 |
+
border-radius: 20px;
|
| 695 |
text-decoration: none;
|
| 696 |
font-weight: bold;
|
| 697 |
+
font-size: 14px;
|
| 698 |
+
backdrop-filter: blur(5px);
|
| 699 |
+
border: 1px solid rgba(102, 126, 234, 0.2);
|
| 700 |
transition: all 0.3s ease;'
|
| 701 |
+
onmouseover="this.style.background='rgba(102, 126, 234, 0.15)'; this.style.transform='translateY(-1px)'"
|
| 702 |
+
onmouseout="this.style.background='rgba(102, 126, 234, 0.1)'; this.style.transform='translateY(0)'">
|
| 703 |
+
<span style='font-size: 16px;'>⭐</span>
|
| 704 |
Star on GitHub
|
| 705 |
</a>
|
| 706 |
</div>
|
|
|
|
|
|
|
|
|
|
| 707 |
</div>
|
| 708 |
</div>
|
| 709 |
""")
|
| 710 |
|
| 711 |
# Example videos section - moved to top
|
| 712 |
+
with gr.Group(elem_classes=["example-videos"]):
|
| 713 |
gr.Markdown("### 📂 Example Videos")
|
| 714 |
gr.Markdown("Try these example videos to get started quickly:")
|
| 715 |
|
| 716 |
+
# Custom horizontal scrolling video gallery
|
| 717 |
+
gr.HTML("""
|
| 718 |
+
<div style='background-color: #f8f9ff; border-radius: 8px; padding: 10px; margin: 10px 0; border-left: 4px solid #667eea;'>
|
| 719 |
+
<p style='margin: 0; font-size: 13px; color: #666; display: flex; align-items: center; gap: 8px;'>
|
| 720 |
+
<span style='font-size: 16px;'>💡</span>
|
| 721 |
+
<strong>Tip:</strong> Scroll horizontally below to see all example videos
|
| 722 |
+
</p>
|
| 723 |
+
</div>
|
| 724 |
+
""")
|
| 725 |
+
|
| 726 |
# Define video_input here so it can be referenced in examples
|
| 727 |
video_input = gr.Video(
|
| 728 |
label="Upload Video or Select Example",
|
| 729 |
+
format="mp4",
|
| 730 |
+
height=300
|
| 731 |
)
|
| 732 |
|
| 733 |
+
# Create a horizontal scrolling container for the examples
|
| 734 |
+
with gr.Group(elem_classes=["horizontal-examples"]):
|
| 735 |
+
gr.Examples(
|
| 736 |
+
examples=[
|
| 737 |
+
["examples/kiss.mp4"],
|
| 738 |
+
["examples/backpack.mp4"],
|
| 739 |
+
["examples/kitchen.mp4"],
|
| 740 |
+
["examples/pillow.mp4"],
|
| 741 |
+
["examples/hockey.mp4"],
|
| 742 |
+
["examples/drifting.mp4"],
|
| 743 |
+
["examples/ball.mp4"],
|
| 744 |
+
["examples/ken_block_0.mp4"],
|
| 745 |
+
["examples/ego_kc1.mp4"],
|
| 746 |
+
["examples/vertical_place.mp4"],
|
| 747 |
+
["examples/ego_teaser.mp4"],
|
| 748 |
+
["examples/robot_unitree.mp4"],
|
| 749 |
+
["examples/droid_robot.mp4"],
|
| 750 |
+
["examples/robot_2.mp4"],
|
| 751 |
+
["examples/cinema_0.mp4"],
|
| 752 |
+
["examples/cinema_1.mp4"],
|
| 753 |
+
],
|
| 754 |
+
inputs=video_input,
|
| 755 |
+
label="🎬 Click on any example to load it",
|
| 756 |
+
examples_per_page=16 # Show all examples on one page
|
| 757 |
+
)
|
| 758 |
|
| 759 |
with gr.Row():
|
| 760 |
with gr.Column(scale=1):
|
|
|
|
| 787 |
gr.Markdown("### 🎬 Tracking Results")
|
| 788 |
tracking_result_video = gr.Video(
|
| 789 |
label="Tracking Result Video",
|
| 790 |
+
interactive=False,
|
| 791 |
+
height=300
|
| 792 |
)
|
| 793 |
|
| 794 |
# 3D Visualization
|