Wav2Lip icon indicating copy to clipboard operation
Wav2Lip copied to clipboard

Added an API version of inference.py

Open sammyf opened this issue 1 year ago • 0 comments

As W2L is quite old and its dependencies can not easily be ported to Python3.11 I wrote a small wrapper that starts a flask server serving W2L.

Additionally, as the application doesn't shut down after each call, the checkpoint isn't unloaded, and is only swapped if another checkpoint path is passed. This results in much better performance on subsequent calls (the first time is obviously still pretty slow if you use a different checkpoint than the default one)

The code in server.py is pretty much the same as that in inference.py. The json payload is minimal though and doesn't accept all parameters (yet?) , only those four :

{
    "checkpoint_path": "checkpoints/wav2lip.pth",
    "face": "whatever.mp4",
    "audio": "whatever.wav",
    "outfile": "result.mp4"
}

The only additional requirement is flask

sammyf avatar Jan 01 '24 16:01 sammyf