|
import os |
|
os.system("hub install wav2lip==1.0.0") |
|
|
|
import gradio as gr |
|
import paddlehub as hub |
|
from pathlib import Path |
|
|
|
module = hub.Module(name="wav2lip") |
|
|
|
def inference(image,audio): |
|
face_input_path = image |
|
audio_input_path = audio |
|
module.wav2lip_transfer(face=face_input_path, audio=audio_input_path, output_dir='./transfer_result/', use_gpu=False) |
|
return './transfer_result/'+Path(image.name).stem+".mp4" |
|
|
|
title = "Wav2lip" |
|
|
|
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." |
|
article = "<p style='text-align: center'><a href='https://github.com/jantic/DeOldify' target='_blank'>Github Repo</a></p>" |
|
|
|
examples=[['lunch.jpeg']] |
|
|
|
iface = gr.Interface(inference, [gr.inputs.Image(type="filepath"),gr.inputs.Audio(type="filepath")], |
|
outputs=gr.outputs.Video(label="Output Video"),examples=examples,enable_queue=True,title=title,article=article,description=description) |
|
iface.launch() |