For use with totally-real-news-bot https://github.com/jeddyhhh/totally-real-news-bot
Modified to save files locally rather than to AWS storage, installs and works the same other than that. Just follow the installation below and it should work
Thanks to Phạm Gia Linh, source peoject
Linux:
-
Installing miniconda, python and git.
-
Creating the env and install the requirements.
git clone https://github.com/phamgialinhlx/sad-talker-api.git
cd sad-talker-api
conda create -n sadtalker python=3.8
conda activate sadtalker
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113
conda install ffmpeg
pip install -r requirements.txt- Create
.envfrom .env.example file - Download models
bash scripts/download_models.sh- Host the server.
uvicorn --host "0.0.0.0" --port "8000" api:app- Build
sadtalkerimage
docker build -t sadtalker .
- Create
.envfrom .env.example file - Run
sadtalkercontainer
docker run --gpus=all --rm -p 8000:8000 -v ./.env:/sadtalker/.env -d --name sadtalker sadtalker
Note: Remember to volume mount .env file to container
The API will be hosted on port 8000. Go to http://127.0.0.1:8000/docs to see API documentation.
curl -X POST "http://localhost:8000/generate/" -H "Content-Type:application/json" -d '{"image_link": "https://raw.githubusercontent.com/OpenTalker/SadTalker/main/examples/source_image/happy.png","audio_link": "https://github.com/OpenTalker/SadTalker/raw/main/examples/driven_audio/chinese_poem2.wav"}'