Ahsen Khaliq commited on
Commit
9c9ead3
·
1 Parent(s): 5b35e2c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -16,19 +16,19 @@ def inference(video):
16
  #os.system('ffmpeg -ss 00:00:00 -i '+ video +' -to 00:00:05 -c copy -y output.mp4')
17
  clip = VideoFileClip(video)
18
  print(clip.duration)
19
- #if clip.duration > 5:
20
- # return 'trim.mp4',"trim.mp4","trim.mp4"
21
  convert_video(
22
  model, # The loaded model, can be on any device (cpu or cuda).
23
  input_source=video, # A video file or an image sequence directory.
24
- input_resize=None, # [Optional] Resize the input (also the output).
25
  downsample_ratio=None, # [Optional] If None, make downsampled max size be 512px.
26
  output_type='video', # Choose "video" or "png_sequence"
27
  output_composition='com.mp4', # File path if video; directory path if png sequence.
28
  output_alpha="pha.mp4", # [Optional] Output the raw alpha prediction.
29
  output_foreground="fgr.mp4", # [Optional] Output the raw foreground prediction.
30
  output_video_mbps=4, # Output video mbps. Not needed for png sequence.
31
- seq_chunk=1, # Process n frames at once for better parallelism.
32
  num_workers=1, # Only for image sequence input. Reader threads.
33
  progress=True # Print conversion progress.
34
  )
 
16
  #os.system('ffmpeg -ss 00:00:00 -i '+ video +' -to 00:00:05 -c copy -y output.mp4')
17
  clip = VideoFileClip(video)
18
  print(clip.duration)
19
+ if clip.duration > 5:
20
+ return 'trim.mp4',"trim.mp4","trim.mp4"
21
  convert_video(
22
  model, # The loaded model, can be on any device (cpu or cuda).
23
  input_source=video, # A video file or an image sequence directory.
24
+ input_resize=(512,512), # [Optional] Resize the input (also the output).
25
  downsample_ratio=None, # [Optional] If None, make downsampled max size be 512px.
26
  output_type='video', # Choose "video" or "png_sequence"
27
  output_composition='com.mp4', # File path if video; directory path if png sequence.
28
  output_alpha="pha.mp4", # [Optional] Output the raw alpha prediction.
29
  output_foreground="fgr.mp4", # [Optional] Output the raw foreground prediction.
30
  output_video_mbps=4, # Output video mbps. Not needed for png sequence.
31
+ seq_chunk=7, # Process n frames at once for better parallelism.
32
  num_workers=1, # Only for image sequence input. Reader threads.
33
  progress=True # Print conversion progress.
34
  )