Ahsen Khaliq commited on
Commit
f232938
1 Parent(s): 374737d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -9
app.py CHANGED
@@ -1,25 +1,19 @@
1
  import os
2
  os.system("hub install wav2lip==1.0.0")
3
-
4
  import gradio as gr
5
  import paddlehub as hub
6
  from pathlib import Path
7
-
8
  module = hub.Module(name="wav2lip")
9
-
10
  def inference(image,audio):
11
  face_input_path = image
12
  audio_input_path = audio
13
- module.wav2lip_transfer(face=face_input_path, audio=audio_input_path, output_dir='./transfer_result/', use_gpu=False)
14
- return './transfer_result/'+Path(image).stem+".mp4"
15
 
16
  title = "Wav2lip"
17
-
18
  description = "Gradio demo for Wav2lip. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
19
  article = "<p style='text-align: center'><a href='https://github.com/jantic/DeOldify' target='_blank'>Github Repo</a></p>"
20
-
21
  examples=[['monatest.jpeg','as_v1_500_1.wav']]
22
-
23
  iface = gr.Interface(inference, [gr.inputs.Image(type="filepath"),gr.inputs.Audio(type="filepath")],
24
  outputs=gr.outputs.Video(label="Output Video"),examples=examples,enable_queue=True,title=title,article=article,description=description)
25
- iface.launch()
 
1
  import os
2
  os.system("hub install wav2lip==1.0.0")
 
3
  import gradio as gr
4
  import paddlehub as hub
5
  from pathlib import Path
 
6
  module = hub.Module(name="wav2lip")
 
7
  def inference(image,audio):
8
  face_input_path = image
9
  audio_input_path = audio
10
+ module.wav2lip_transfer(face=face_input_path, audio=audio_input_path, output_dir='.', use_gpu=True)
11
+ return "result.mp4"
12
 
13
  title = "Wav2lip"
 
14
  description = "Gradio demo for Wav2lip. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
15
  article = "<p style='text-align: center'><a href='https://github.com/jantic/DeOldify' target='_blank'>Github Repo</a></p>"
 
16
  examples=[['monatest.jpeg','as_v1_500_1.wav']]
 
17
  iface = gr.Interface(inference, [gr.inputs.Image(type="filepath"),gr.inputs.Audio(type="filepath")],
18
  outputs=gr.outputs.Video(label="Output Video"),examples=examples,enable_queue=True,title=title,article=article,description=description)
19
+ iface.launch(debug=True)