Commit
•
28cbc54
1
Parent(s):
3d92ac3
Update handler.py
Browse files- handler.py +10 -11
handler.py
CHANGED
@@ -273,18 +273,17 @@ class EndpointHandler:
|
|
273 |
raise ValueError(f"Expected tensor of shape [frames, channels, height, width], got shape {frames.shape}")
|
274 |
|
275 |
# Post-process frames
|
276 |
-
|
277 |
-
loop = asyncio.new_event_loop()
|
278 |
-
|
279 |
try:
|
280 |
-
|
281 |
-
|
282 |
-
)
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
|
|
288 |
return {
|
289 |
"video": video_uri,
|
290 |
"content-type": "video/mp4",
|
|
|
273 |
raise ValueError(f"Expected tensor of shape [frames, channels, height, width], got shape {frames.shape}")
|
274 |
|
275 |
# Post-process frames
|
276 |
+
|
|
|
|
|
277 |
try:
|
278 |
+
loop = asyncio.get_event_loop()
|
279 |
+
except RuntimeError:
|
280 |
+
loop = asyncio.new_event_loop()
|
281 |
+
asyncio.set_event_loop(loop)
|
282 |
+
|
283 |
+
video_uri, metadata = loop.run_until_complete(
|
284 |
+
self.process_frames(frames, config)
|
285 |
+
)
|
286 |
+
|
287 |
return {
|
288 |
"video": video_uri,
|
289 |
"content-type": "video/mp4",
|