EC2 Default User commited on
Commit
cf1bfd7
1 Parent(s): fb46ce6

Fixing no face recognition

Browse files
Files changed (1) hide show
  1. app.py +16 -13
app.py CHANGED
@@ -162,12 +162,18 @@ def create_video(Text,Voicetoclone):
162
  out_file="../"+out_name
163
 
164
  if nosmooth == False:
165
- os.system('{} cd Wav2Lip && python inference.py --checkpoint_path checkpoints/wav2lip_gan.pth --face "../sample_data/input_video.mp4" --audio "../out/clonned_audio.wav" --outfile {} --pads {} {} {} {} --resize_factor {}'.format(env,out_file,pad_top ,pad_bottom ,pad_left ,pad_right ,rescaleFactor))
166
  else:
167
- os.system('{} cd Wav2Lip && python inference.py --checkpoint_path checkpoints/wav2lip_gan.pth --face "../sample_data/input_video.mp4" --audio "../out/clonned_audio.wav" --outfile {} --pads {} {} {} {} --resize_factor {} --nosmooth'.format(env,out_file,pad_top ,pad_bottom ,pad_left ,pad_right ,rescaleFactor))
168
 
 
 
 
 
 
 
169
  #clear_output()
170
- print("Creation of Video done")
171
  return out_name
172
 
173
 
@@ -283,30 +289,27 @@ demo = gr.Interface(fn = video_generator,
283
  </p>
284
  </div>''',
285
 
286
- examples = [['I am clonning your voice, Charles!. Machine intelligence is the last invention that humanity will ever need to make.',
287
  "https://www.youtube.com/watch?v=xw5dvItD5zY",
288
  "00:00:01","00:00:10"],
289
- ['I am clonning your voice, Jim Carrey!. Machine intelligence is the last invention that humanity will ever need to make.',
290
  "https://www.youtube.com/watch?v=uIaY0l5qV0c",
291
  "00:00:29", "00:01:05"],
292
- ['I am clonning your voice, Mark Zuckerberg!. Machine intelligence is the last invention that humanity will ever need to make.',
293
  "https://www.youtube.com/watch?v=AYjDIFrY9rc",
294
  "00:00:11", "00:00:44"],
295
- ['I am clonning your voice, Ronald Reagan!. Machine intelligence is the last invention that humanity will ever need to make.',
296
  "https://www.youtube.com/watch?v=iuoRDY9c5SQ",
297
  "00:01:03", "00:01:22"],
298
- ['I am clonning your voice, Elon Musk!. Machine intelligence is the last invention that humanity will ever need to make.',
299
  "https://www.youtube.com/watch?v=IZ8JQ_1gytg",
300
  "00:00:10", "00:00:43"],
301
- ['I am clonning your voice, Hitler!. Machine intelligence is the last invention that humanity will ever need to make.',
302
  "https://www.youtube.com/watch?v=F08wrLyH5cs",
303
  "00:00:15", "00:00:40"],
304
- ['I am clonning your voice, Alexandria!. Machine intelligence is the last invention that humanity will ever need to make.',
305
  "https://www.youtube.com/watch?v=Eht6oIkzkew",
306
  "00:00:02", "00:00:30"],
307
- ['I am clonning your voice, Deborah!. Machine intelligence is the last invention that humanity will ever need to make.',
308
- "https://www.youtube.com/watch?v=qbq4_Swj0Gg",
309
- "00:00:03", "00:0:44"],
310
  ]
311
  )
312
  demo.launch()
 
162
  out_file="../"+out_name
163
 
164
  if nosmooth == False:
165
+ is_command_ok = os.system('{} cd Wav2Lip && python inference.py --checkpoint_path checkpoints/wav2lip_gan.pth --face "../sample_data/input_video.mp4" --audio "../out/clonned_audio.wav" --outfile {} --pads {} {} {} {} --resize_factor {}'.format(env,out_file,pad_top ,pad_bottom ,pad_left ,pad_right ,rescaleFactor))
166
  else:
167
+ is_command_ok = os.system('{} cd Wav2Lip && python inference.py --checkpoint_path checkpoints/wav2lip_gan.pth --face "../sample_data/input_video.mp4" --audio "../out/clonned_audio.wav" --outfile {} --pads {} {} {} {} --resize_factor {} --nosmooth'.format(env,out_file,pad_top ,pad_bottom ,pad_left ,pad_right ,rescaleFactor))
168
 
169
+ if is_command_ok > 0:
170
+ print("Error : Ensure the video contains a face in all the frames.")
171
+ out_file="../demo/tryagain1.mp4"
172
+ return out_file
173
+ else:
174
+ print("OK")
175
  #clear_output()
176
+ print("Creation of video done!")
177
  return out_name
178
 
179
 
 
289
  </p>
290
  </div>''',
291
 
292
+ examples = [['I am clonning your voice. Charles!. Machine intelligence is the last invention that humanity will ever need to make.',
293
  "https://www.youtube.com/watch?v=xw5dvItD5zY",
294
  "00:00:01","00:00:10"],
295
+ ['I am clonning your voice. Jim Carrey!. Machine intelligence is the last invention that humanity will ever need to make.',
296
  "https://www.youtube.com/watch?v=uIaY0l5qV0c",
297
  "00:00:29", "00:01:05"],
298
+ ['I am clonning your voice. Mark Zuckerberg!. Machine intelligence is the last invention that humanity will ever need to make.',
299
  "https://www.youtube.com/watch?v=AYjDIFrY9rc",
300
  "00:00:11", "00:00:44"],
301
+ ['I am clonning your voice. Ronald Reagan!. Machine intelligence is the last invention that humanity will ever need to make.',
302
  "https://www.youtube.com/watch?v=iuoRDY9c5SQ",
303
  "00:01:03", "00:01:22"],
304
+ ['I am clonning your voice. Elon Musk!. Machine intelligence is the last invention that humanity will ever need to make.',
305
  "https://www.youtube.com/watch?v=IZ8JQ_1gytg",
306
  "00:00:10", "00:00:43"],
307
+ ['I am clonning your voice. Hitler!. Machine intelligence is the last invention that humanity will ever need to make.',
308
  "https://www.youtube.com/watch?v=F08wrLyH5cs",
309
  "00:00:15", "00:00:40"],
310
+ ['I am clonning your voice. Alexandria!. Machine intelligence is the last invention that humanity will ever need to make.',
311
  "https://www.youtube.com/watch?v=Eht6oIkzkew",
312
  "00:00:02", "00:00:30"],
 
 
 
313
  ]
314
  )
315
  demo.launch()