Ahsen Khaliq
commited on
Commit
•
edee3e1
1
Parent(s):
dfef381
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.name
|
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.name).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=[['lunch.jpeg']]
|
22 |
+
|
23 |
+
iface = gr.Interface(inference, inputs=gr.inputs.Image(type="file"),
|
24 |
+
outputs=gr.outputs.Image(type="file"),examples=examples,enable_queue=True,title=title,article=article,description=description)
|
25 |
+
iface.launch()
|