TTS using Balacoon TTS light, REST API wrapper with FastAPI and Docker, for your text-to-speech needs on small device like raspberry-pi🤖
- run
./setup.sh
to download the modelen_us_hifi92_light_cpu.addon
- To build image, run
docker build . --tag my/tts-api
- To run image, run
docker run -d -p 7861:7861 -v ./audio:/code/audio -v ./model:/code/model --name tts-api my/tts-api
⚠️ Note: Make sure to have the-v
volume parameter to avoid redownloading models. - Go to
http://127.0.0.1:7861/api/
to check the app
- To convert text to speech, use the
POST
endpoint/api/tts/
with payload of{message:"read this",name:"arnold",sample_rate:1.0}
.message
is the text to be read andname
is the file name for th wav whilesample_rate
controls the sampling rate. this returns the filename of the audio. - To read back converted speech, use the
GET
endpoint/api/voice/
with audio filename set a query paramsname
e.g..../api/voice?name=sample01.wav
- All generated audio are saved in
audio/outputs
folder with the file name<sample>_<timestamp>
. - Check
http://localhost:7861/docs
for OpenAPI documentation