xiaoyuxi commited on
Commit
53e877e
·
1 Parent(s): 2a1f271
Files changed (1) hide show
  1. app.py +82 -44
app.py CHANGED
@@ -986,40 +986,39 @@ with gr.Blocks(
986
  with gr.Group():
987
  gr.Markdown("### 📂 Select Video")
988
 
 
989
  video_input = gr.Video(
990
  label="Upload Video or Select Example",
991
  format="mp4",
992
  height=250 # Matched height with 3D viz
993
  )
994
 
995
- # Compact horizontal examples
996
- gr.Markdown("**Examples:** (scroll horizontally)")
997
- with gr.Group(elem_classes=["horizontal-examples"]):
998
- gr.Examples(
999
- examples=[
1000
- ["examples/kiss.mp4"],
1001
- ["examples/backpack.mp4"],
1002
- ["examples/pillow.mp4"],
1003
- ["examples/handwave.mp4"],
1004
- ["examples/hockey.mp4"],
1005
- ["examples/drifting.mp4"],
1006
- ["examples/ken_block_0.mp4"],
1007
- ["examples/kitchen.mp4"],
1008
- ["examples/basketball.mp4"],
1009
- ["examples/ego_kc1.mp4"],
1010
- ["examples/vertical_place.mp4"],
1011
- ["examples/ego_teaser.mp4"],
1012
- ["examples/robot_unitree.mp4"],
1013
- ["examples/robot_3.mp4"],
1014
- ["examples/teleop2.mp4"],
1015
- ["examples/pusht.mp4"],
1016
- ["examples/cinema_0.mp4"],
1017
- ["examples/cinema_1.mp4"],
1018
- ],
1019
- inputs=video_input,
1020
- label="",
1021
- examples_per_page=18
1022
  )
 
 
 
 
1023
 
1024
  with gr.Column(scale=1):
1025
  # 3D Visualization - moved to top right for immediate visibility
@@ -1077,11 +1076,17 @@ with gr.Blocks(
1077
 
1078
  # Advanced Point Selection with SAM - Collapsed by default
1079
  with gr.Accordion("🎯 Advanced: Manual Point Selection with SAM", open=False):
1080
- gr.Markdown("""
1081
- **Use SAM (Segment Anything Model) for precise object selection:**
1082
- - Click on target objects in the image for SAM-guided segmentation
1083
- - Positive points: include these areas | Negative points: exclude these areas
1084
- - Get more accurate 3D tracking results with SAM's powerful segmentation
 
 
 
 
 
 
1085
  """)
1086
 
1087
  with gr.Row():
@@ -1124,22 +1129,55 @@ with gr.Blocks(
1124
  # Compact footer
1125
  gr.HTML("""
1126
  <div style='background: linear-gradient(135deg, #e8eaff 0%, #f0f2ff 100%);
1127
- border-radius: 8px; padding: 12px; margin: 10px 0;
1128
- box-shadow: 0 1px 4px rgba(102, 126, 234, 0.1);
1129
  border: 1px solid rgba(102, 126, 234, 0.15);'>
1130
- <div style='display: flex; justify-content: space-between; align-items: center; color: #4a5568;'>
1131
- <div style='display: flex; align-items: center; gap: 15px;'>
1132
- <a href="https://github.com/henry123-boy/SpaTrackerV2" target="_blank"
1133
- style='display: flex; align-items: center; gap: 5px; text-decoration: none; color: #4a5568; font-weight: 500;'>
1134
- Star on GitHub
1135
- </a>
1136
- <span style='color: #ccc;'>|</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1137
  <a href="https://github.com/zbw001/TAPIP3D" target="_blank"
1138
- style='display: flex; align-items: center; gap: 5px; text-decoration: none; color: #4a5568; font-size: 12px;'>
1139
- 📚 TAPIP3D Acknowledgments
 
 
 
 
 
 
1140
  </a>
1141
  </div>
1142
- <span style='font-size: 11px; color: #666;'>Powered by SpatialTracker V2</span>
 
 
 
 
 
1143
  </div>
1144
  </div>
1145
  """)
 
986
  with gr.Group():
987
  gr.Markdown("### 📂 Select Video")
988
 
989
+ # Define video_input here so it can be referenced in examples
990
  video_input = gr.Video(
991
  label="Upload Video or Select Example",
992
  format="mp4",
993
  height=250 # Matched height with 3D viz
994
  )
995
 
996
+ # Horizontal video examples with slider
997
+ gr.Markdown("**Examples:** (use slider to browse)")
998
+
999
+ # Create a horizontal slider for examples
1000
+ with gr.Row():
1001
+ example_slider = gr.Slider(
1002
+ minimum=0,
1003
+ maximum=17, # 18 examples (0-17)
1004
+ step=1,
1005
+ value=0,
1006
+ label="Browse Examples",
1007
+ info="Slide to see different example videos"
1008
+ )
1009
+
1010
+ # Example video display
1011
+ with gr.Row():
1012
+ example_video = gr.Video(
1013
+ label="Preview Example Video (click to load)",
1014
+ height=150,
1015
+ interactive=False,
1016
+ show_label=True
 
 
 
 
 
 
1017
  )
1018
+
1019
+ # Load example button
1020
+ with gr.Row():
1021
+ load_example_btn = gr.Button("📥 Load This Example", variant="secondary", size="sm")
1022
 
1023
  with gr.Column(scale=1):
1024
  # 3D Visualization - moved to top right for immediate visibility
 
1076
 
1077
  # Advanced Point Selection with SAM - Collapsed by default
1078
  with gr.Accordion("🎯 Advanced: Manual Point Selection with SAM", open=False):
1079
+ gr.HTML("""
1080
+ <div style='margin-bottom: 15px;'>
1081
+ <h4 style='color: #667eea; font-size: 16px; font-weight: bold; margin-bottom: 10px;'>
1082
+ 🔬 Use SAM (Segment Anything Model) for Precise Object Selection
1083
+ </h4>
1084
+ <ul style='color: #4a5568; font-size: 14px; line-height: 1.6; margin: 0; padding-left: 20px;'>
1085
+ <li>Click on target objects in the image for SAM-guided segmentation</li>
1086
+ <li>Positive points: include these areas | Negative points: exclude these areas</li>
1087
+ <li>Get more accurate 3D tracking results with SAM's powerful segmentation</li>
1088
+ </ul>
1089
+ </div>
1090
  """)
1091
 
1092
  with gr.Row():
 
1129
  # Compact footer
1130
  gr.HTML("""
1131
  <div style='background: linear-gradient(135deg, #e8eaff 0%, #f0f2ff 100%);
1132
+ border-radius: 8px; padding: 20px; margin: 15px 0;
1133
+ box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
1134
  border: 1px solid rgba(102, 126, 234, 0.15);'>
1135
+ <div style='text-align: center; margin-bottom: 15px;'>
1136
+ <h3 style='color: #4a5568; margin: 0 0 10px 0; font-size: 18px; font-weight: 600;'>
1137
+ Love SpatialTracker? Give us a Star! ⭐
1138
+ </h3>
1139
+ <p style='color: #666; margin: 0 0 15px 0; font-size: 14px; line-height: 1.5;'>
1140
+ Help us grow by starring our repository on GitHub! Your support means a lot to the community. 🚀
1141
+ </p>
1142
+ <a href="https://github.com/henry123-boy/SpaTrackerV2" target="_blank"
1143
+ style='display: inline-flex; align-items: center; gap: 8px;
1144
+ background: rgba(102, 126, 234, 0.1); color: #4a5568;
1145
+ padding: 10px 20px; border-radius: 25px; text-decoration: none;
1146
+ font-weight: bold; font-size: 14px; border: 1px solid rgba(102, 126, 234, 0.2);
1147
+ transition: all 0.3s ease;'
1148
+ onmouseover="this.style.background='rgba(102, 126, 234, 0.15)'; this.style.transform='translateY(-2px)'"
1149
+ onmouseout="this.style.background='rgba(102, 126, 234, 0.1)'; this.style.transform='translateY(0)'">
1150
+ <span style='font-size: 16px;'>⭐</span>
1151
+ Star SpatialTracker V2 on GitHub
1152
+ </a>
1153
+ </div>
1154
+
1155
+ <div style='background: linear-gradient(135deg, #fff8e1 0%, #fffbf0 100%);
1156
+ border-radius: 8px; padding: 15px; border: 1px solid rgba(255, 193, 7, 0.2);'>
1157
+ <div style='text-align: center;'>
1158
+ <h4 style='color: #5d4037; margin: 0 0 8px 0; font-size: 16px; font-weight: 600;'>
1159
+ 📚 Acknowledgments
1160
+ </h4>
1161
+ <p style='color: #5d4037; margin: 0 0 10px 0; font-size: 13px; line-height: 1.4;'>
1162
+ Our 3D visualizer is adapted from <strong>TAPIP3D</strong>. We thank the authors for their excellent work and contribution to the computer vision community!
1163
+ </p>
1164
  <a href="https://github.com/zbw001/TAPIP3D" target="_blank"
1165
+ style='display: inline-flex; align-items: center; gap: 6px;
1166
+ background: rgba(255, 193, 7, 0.15); color: #5d4037;
1167
+ padding: 8px 16px; border-radius: 20px; text-decoration: none;
1168
+ font-weight: 500; font-size: 13px; border: 1px solid rgba(255, 193, 7, 0.3);
1169
+ transition: all 0.3s ease;'
1170
+ onmouseover="this.style.background='rgba(255, 193, 7, 0.25)'"
1171
+ onmouseout="this.style.background='rgba(255, 193, 7, 0.15)'">
1172
+ 📚 Visit TAPIP3D Repository
1173
  </a>
1174
  </div>
1175
+ </div>
1176
+
1177
+ <div style='text-align: center; margin-top: 10px;'>
1178
+ <span style='font-size: 12px; color: #888; font-style: italic;'>
1179
+ Powered by SpatialTracker V2 | Built with ❤️ for the Computer Vision Community
1180
+ </span>
1181
  </div>
1182
  </div>
1183
  """)