Spanicin commited on
Commit
1c38d2d
1 Parent(s): 3b5369b

Update videoretalking/inference_function.py

Browse files
videoretalking/inference_function.py CHANGED
@@ -4,6 +4,7 @@ from tqdm import tqdm
4
  from PIL import Image
5
  from scipy.io import loadmat
6
  from moviepy.editor import AudioFileClip, VideoFileClip
 
7
 
8
  sys.path.insert(0, 'third_part')
9
  sys.path.insert(0, 'third_part/GPEN')
@@ -278,6 +279,9 @@ def video_lipsync_correctness(face, audio_path, face3d_net_path, outfile=None, t
278
  # Write the result to the output file
279
  video_clip.write_videofile(outfile, codec='libx264', audio_codec='aac')
280
  print('outfile:', outfile)
 
 
 
281
 
282
  # frames:256x256, full_frames: original size
283
  def datagen(frames, mels, full_frames, frames_pil, cox, face, static, LNet_batch_size, img_size):
 
4
  from PIL import Image
5
  from scipy.io import loadmat
6
  from moviepy.editor import AudioFileClip, VideoFileClip
7
+ import shutil
8
 
9
  sys.path.insert(0, 'third_part')
10
  sys.path.insert(0, 'third_part/GPEN')
 
279
  # Write the result to the output file
280
  video_clip.write_videofile(outfile, codec='libx264', audio_codec='aac')
281
  print('outfile:', outfile)
282
+ if os.path.isdir(tmp_dir):
283
+ shutil.rmtree(tmp_dir)
284
+ print(f'Cleaned up temporary directory: {tmp_dir}')
285
 
286
  # frames:256x256, full_frames: original size
287
  def datagen(frames, mels, full_frames, frames_pil, cox, face, static, LNet_batch_size, img_size):