This container functions as a small wrapper for the ToHyve TTS service to let it process larger text. Normally the TTS service sends an error message, if the input text is too long. The Bite Cutter takes the input text, sends it to the TTS and recursively cuts the text into smaller pieces, if an error arises.
- The interaction is basically the same as with the TTS tool itself with only a few differences
- Create the audio file:
curl -X POST \
-H "Content-Type:application/json" \
-d @text.json \
-o predict.txt \
http://localhost:8006/split
Where text.json is a JSON file, which contains input data.
{
"data": [
"de",
"Zum Frühstück gibt es Marmelade."
]
}
The file predict.txt is a text file, that will contain the path of the audio file after it was created.
- Download the created audio file, using the path from the predict.txt file
curl -o /tmp/output.wav \
http://localhost:8006/app/$FILEPATH
Use the following comand to send the text from the text.json file to the system and download the wav file into the present working directory:
# Run the first curl comand
# input_text.json contains the text that will be turned into speech
curl -X POST \
-H "Content-Type:application/json" \
-d @input_text.json \
-o predict.txt \
https://dfki-3109.dfki.de/split \
# Extract the file path from predict.txt
# FILEPATH=$(jq -r '.data[].name' predict.txt)
FILEPATH=$(tr -d '"' < predict.txt)
# Run the second curl comand
# it downloads the wav file specified in predict.txt
curl -o output.wav \
https://dfki-3109.dfki.de/$FILEPATH
On the dfki-3109.de server, the TTS service and the Bite-Cutter are running. They are both located in a docker network in order to interact with eachother. This way, the Bite-Cutter can accept the http POST requests, send them to the TTS service and open a way for the download. This means, that the URL in the original docker are not localhost, but tts_container, which points to the TTS service inside the docker network.