Update TTS component
This commit is contained in:
@@ -25,21 +25,30 @@ fi
|
||||
|
||||
tts_host=${TTS_API_HOST:-"http://localhost:8000"}
|
||||
|
||||
declare -A voices_model=(
|
||||
[ff_siwis]="speaches-ai/Kokoro-82M-v1.0-ONNX-int8"
|
||||
[tom]="speaches-ai/piper-fr_FR-tom-medium"
|
||||
[upmc]="speaches-ai/piper-fr_FR-upmc-medium"
|
||||
[alba]="speaches-ai/piper-en_GB-alba-medium"
|
||||
[northern_english_male]="speaches-ai/piper-en_GB-northern_english_male-medium"
|
||||
[john]="speaches-ai/piper-en_US-john-medium"
|
||||
[bryce]="speaches-ai/piper-en_US-bryce-medium"
|
||||
[ryan]="speaches-ai/piper-en_US-ryan-high"
|
||||
)
|
||||
|
||||
_choice_voice() {
|
||||
|
||||
if [[ "${argc_lang}" == "fr" ]]; then
|
||||
echo siwis
|
||||
echo ff_siwis
|
||||
echo tom
|
||||
echo pierre
|
||||
echo jessica
|
||||
echo upmc
|
||||
fi
|
||||
if [[ "${argc_lang}" == "en" ]]; then
|
||||
echo alba
|
||||
echo jack
|
||||
echo northern_english_male
|
||||
echo john
|
||||
echo bryce
|
||||
echo ryan
|
||||
echo echo
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -52,10 +61,11 @@ _choice_voice() {
|
||||
# @arg text! Set the text
|
||||
synthesize() {
|
||||
|
||||
http_status_code=$(curl -s "${tts_host}/v1/audio/speech" -o "${argc_filename}" -w "%{http_code}" \
|
||||
model=$(echo ${voices_model[$argc_voice]})
|
||||
http_status_code=$(curl -s -X POST "${tts_host}/v1/audio/speech" -o "${argc_filename}" -w "%{http_code}" \
|
||||
-H "Authorization: Bearer ${LLM_API_KEY}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"model\": \"tts-1\",\"input\": \"${argc_text}\",\"voice\": \"${argc_voice}\",\"response_format\": \"wav\",\"speed\": ${argc_speed}}")
|
||||
-d "{\"model\": \"${model}\",\"input\": \"${argc_text}\",\"voice\": \"${argc_voice}\",\"response_format\": \"wav\",\"speed\": ${argc_speed}}")
|
||||
|
||||
# Check the response code for successful HTTP request
|
||||
if [[ "${http_status_code}" -ne 200 ]]; then
|
||||
|
||||
Reference in New Issue
Block a user