From 920830549aef7ae80001c61931f870ac427ab3e4 Mon Sep 17 00:00:00 2001 From: lijianshe02 <48898730+lijianshe02@users.noreply.github.com> Date: Fri, 5 Mar 2021 11:42:40 +0800 Subject: [PATCH] fix face path caused unsafe bug (#214) --- ppgan/apps/wav2lip_predictor.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ppgan/apps/wav2lip_predictor.py b/ppgan/apps/wav2lip_predictor.py index 4ba30e2..d29c76e 100644 --- a/ppgan/apps/wav2lip_predictor.py +++ b/ppgan/apps/wav2lip_predictor.py @@ -19,9 +19,8 @@ mel_step_size = 16 class Wav2LipPredictor(BasePredictor): def __init__(self, args): self.args = args - if os.path.isfile(self.args.face) and self.args.face.split('.')[1] in [ - 'jpg', 'png', 'jpeg' - ]: + if os.path.isfile(self.args.face) and path.basename( + self.args.face).split('.')[1] in ['jpg', 'png', 'jpeg']: self.args.static = True self.img_size = 96 makedirs('./temp', exist_ok=True) @@ -147,7 +146,8 @@ class Wav2LipPredictor(BasePredictor): raise ValueError( '--face argument must be a valid path to video/image file') - elif self.args.face.split('.')[1] in ['jpg', 'png', 'jpeg']: + elif path.basename( + self.args.face).split('.')[1] in ['jpg', 'png', 'jpeg']: full_frames = [cv2.imread(self.args.face)] fps = self.args.fps -- GitLab