Commit
•
0d0a1bc
1
Parent(s):
be2df75
Update handler.py
Browse files- handler.py +13 -0
handler.py
CHANGED
@@ -210,6 +210,19 @@ class EndpointHandler:
|
|
210 |
frames = self.image_to_video(**generation_kwargs).frames
|
211 |
else:
|
212 |
frames = self.text_to_video(**generation_kwargs).frames
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
|
214 |
# Post-process frames
|
215 |
loop = asyncio.new_event_loop()
|
|
|
210 |
frames = self.image_to_video(**generation_kwargs).frames
|
211 |
else:
|
212 |
frames = self.text_to_video(**generation_kwargs).frames
|
213 |
+
|
214 |
+
# Log original shape
|
215 |
+
logger.info(f"Original frames shape: {frames.shape}")
|
216 |
+
|
217 |
+
# Remove batch dimension if present
|
218 |
+
if len(frames.shape) == 5:
|
219 |
+
frames = frames.squeeze(0) # Remove batch dimension
|
220 |
+
|
221 |
+
logger.info(f"Processed frames shape: {frames.shape}")
|
222 |
+
|
223 |
+
# Ensure we have the correct shape
|
224 |
+
if len(frames.shape) != 4:
|
225 |
+
raise ValueError(f"Expected tensor of shape [frames, channels, height, width], got shape {frames.shape}")
|
226 |
|
227 |
# Post-process frames
|
228 |
loop = asyncio.new_event_loop()
|