goryhon commited on
Commit
a8cd62e
·
verified ·
1 Parent(s): e1a45e7

Update web-demos/hugging_face/app.py

Browse files
Files changed (1) hide show
  1. web-demos/hugging_face/app.py +5 -2
web-demos/hugging_face/app.py CHANGED
@@ -334,7 +334,7 @@ def inpaint_video(video_state, resize_ratio_number, dilate_radius_number, raft_i
334
 
335
 
336
  # generate video after vos inference
337
- def generate_video_from_frames(frames, output_path, fps=30):
338
  """
339
  Generates a video from a list of frames.
340
 
@@ -369,7 +369,10 @@ def generate_video_from_frames(frames, output_path, fps=30):
369
  # Write the video
370
  #torchvision.io.write_video(output_path, frames, fps=fps, video_codec="libx264")
371
  #return output_path
372
- writer = imageio.get_writer(output_path, fps=fps, codec='libx264', bitrate=bitrate)
 
 
 
373
  for frame in frames:
374
  writer.append_data(frame.astype(np.uint8))
375
  writer.close()
 
334
 
335
 
336
  # generate video after vos inference
337
+ def generate_video_from_frames(frames, output_path, fps=30, bitrate=None):
338
  """
339
  Generates a video from a list of frames.
340
 
 
369
  # Write the video
370
  #torchvision.io.write_video(output_path, frames, fps=fps, video_codec="libx264")
371
  #return output_path
372
+ if bitrate is not None:
373
+ writer = imageio.get_writer(output_path, fps=fps, codec='libx264', bitrate=bitrate)
374
+ else:
375
+ writer = imageio.get_writer(output_path, fps=fps, codec='libx264')
376
  for frame in frames:
377
  writer.append_data(frame.astype(np.uint8))
378
  writer.close()