Update colab.py
Browse files
colab.py
CHANGED
@@ -174,18 +174,21 @@ class DanceGenerator:
|
|
174 |
|
175 |
if pattern_idx < num_patterns - 1:
|
176 |
t = progress * (num_patterns - 1) - pattern_idx
|
177 |
-
pose
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
)
|
182 |
else:
|
183 |
-
pose = patterns[-1]
|
184 |
|
185 |
return pose
|
186 |
|
187 |
def _interpolate_poses(self, pose1, pose2, t):
|
188 |
"""Smoothly interpolate between two poses"""
|
|
|
|
|
|
|
|
|
189 |
return pose1 * (1 - t) + pose2 * t
|
190 |
|
191 |
def _create_enhanced_dance_frame(self, pose_array, frame_size, add_effects=True):
|
|
|
174 |
|
175 |
if pattern_idx < num_patterns - 1:
|
176 |
t = progress * (num_patterns - 1) - pattern_idx
|
177 |
+
# Extract pose arrays from pattern dictionaries
|
178 |
+
pose1 = patterns[pattern_idx]['pose']
|
179 |
+
pose2 = patterns[pattern_idx + 1]['pose']
|
180 |
+
pose = self._interpolate_poses(pose1, pose2, t)
|
|
|
181 |
else:
|
182 |
+
pose = patterns[-1]['pose']
|
183 |
|
184 |
return pose
|
185 |
|
186 |
def _interpolate_poses(self, pose1, pose2, t):
|
187 |
"""Smoothly interpolate between two poses"""
|
188 |
+
if isinstance(pose1, dict):
|
189 |
+
pose1 = pose1['pose']
|
190 |
+
if isinstance(pose2, dict):
|
191 |
+
pose2 = pose2['pose']
|
192 |
return pose1 * (1 - t) + pose2 * t
|
193 |
|
194 |
def _create_enhanced_dance_frame(self, pose_array, frame_size, add_effects=True):
|