jbilcke-hf HF staff commited on
Commit
a5265d3
1 Parent(s): 0d0a1bc

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +6 -2
handler.py CHANGED
@@ -6,6 +6,7 @@ import base64
6
  import io
7
  import logging
8
  import random
 
9
 
10
  import numpy as np
11
  import torch
@@ -230,6 +231,8 @@ class EndpointHandler:
230
  video_uri, metadata = loop.run_until_complete(
231
  self.process_frames(frames, config)
232
  )
 
 
233
  finally:
234
  loop.close()
235
 
@@ -240,5 +243,6 @@ class EndpointHandler:
240
  }
241
 
242
  except Exception as e:
243
- logger.error(f"Error generating video: {str(e)}")
244
- raise RuntimeError(f"Error generating video: {str(e)}")
 
 
6
  import io
7
  import logging
8
  import random
9
+ import traceback
10
 
11
  import numpy as np
12
  import torch
 
231
  video_uri, metadata = loop.run_until_complete(
232
  self.process_frames(frames, config)
233
  )
234
+ except Exception as e:
235
+ raise RuntimeError(f"Failed to convert the frames to a video, because {str(e)}")
236
  finally:
237
  loop.close()
238
 
 
243
  }
244
 
245
  except Exception as e:
246
+ message = f"Error generating video ({str(e)})\n{traceback.format_exc()}"
247
+ print(message)
248
+ raise RuntimeError(message)