guardiancc commited on
Commit
4e4aa93
·
verified ·
1 Parent(s): 67bafeb

Update inference.py

Browse files
Files changed (1) hide show
  1. inference.py +3 -1
inference.py CHANGED
@@ -236,6 +236,7 @@ def read_frames():
236
  yield frame
237
 
238
  def main():
 
239
  if not os.path.isfile(args.face):
240
  raise ValueError('--face argument must be a valid path to video/image file')
241
 
@@ -342,7 +343,8 @@ def main():
342
  f[y1:y2, x1:x2] = p
343
  out.write(f)
344
 
345
- out.release()
 
346
 
347
  command = 'ffmpeg -y -i {} -i {} -strict -2 -q:v 1 {}'.format(args.audio, 'temp/result.avi', args.outfile)
348
  subprocess.call(command, shell=platform.system() != 'Windows')
 
236
  yield frame
237
 
238
  def main():
239
+ out = None
240
  if not os.path.isfile(args.face):
241
  raise ValueError('--face argument must be a valid path to video/image file')
242
 
 
343
  f[y1:y2, x1:x2] = p
344
  out.write(f)
345
 
346
+ if out != None:
347
+ out.release()
348
 
349
  command = 'ffmpeg -y -i {} -i {} -strict -2 -q:v 1 {}'.format(args.audio, 'temp/result.avi', args.outfile)
350
  subprocess.call(command, shell=platform.system() != 'Windows')