jbilcke-hf HF staff commited on
Commit
14c6c40
1 Parent(s): c21df80

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -206,8 +206,8 @@ def interpolate_video_frames(
206
  output_fps=hardcoded_fps,
207
  desired_duration=hardcoded_duration_sec,
208
  original_duration=hardcoded_duration_sec,
209
- output_width=1024,
210
- output_height=576,
211
  use_cuda=False, # this requires FFmpeg to have been compiled with CUDA support (to try - I'm not sure the Hugging Face image has that by default)
212
  verbose=False):
213
 
@@ -216,6 +216,10 @@ def interpolate_video_frames(
216
  filters = []
217
 
218
  # Scaling if dimensions are provided
 
 
 
 
219
  if output_width and output_height:
220
  filters.append(f'scale={output_width}:{output_height}')
221
 
@@ -244,6 +248,7 @@ def interpolate_video_frames(
244
  '-i', input_file_path,
245
  ]
246
 
 
247
  if use_cuda:
248
  cmd.extend(['-hwaccel', 'cuda', '-hwaccel_output_format', 'cuda'])
249
 
@@ -387,7 +392,7 @@ with gr.Blocks() as demo:
387
  minimum=128,
388
  maximum=2048,
389
  step=32,
390
- value=256,
391
  )
392
  select_motion = gr.Dropdown(
393
  label='Motion',
 
206
  output_fps=hardcoded_fps,
207
  desired_duration=hardcoded_duration_sec,
208
  original_duration=hardcoded_duration_sec,
209
+ output_width=None,
210
+ output_height=None,
211
  use_cuda=False, # this requires FFmpeg to have been compiled with CUDA support (to try - I'm not sure the Hugging Face image has that by default)
212
  verbose=False):
213
 
 
216
  filters = []
217
 
218
  # Scaling if dimensions are provided
219
+ # note: upscaling produces disastrous results,
220
+ # it will double the compute time
221
+ # I think that's either because we are not hardware-accelerated,
222
+ # or because of the interpolation done after it, which thus become more computationally intensive
223
  if output_width and output_height:
224
  filters.append(f'scale={output_width}:{output_height}')
225
 
 
248
  '-i', input_file_path,
249
  ]
250
 
251
+ # not supported by the current image, we will have to build it
252
  if use_cuda:
253
  cmd.extend(['-hwaccel', 'cuda', '-hwaccel_output_format', 'cuda'])
254
 
 
392
  minimum=128,
393
  maximum=2048,
394
  step=32,
395
+ value=288,
396
  )
397
  select_motion = gr.Dropdown(
398
  label='Motion',