Spaces:
Running
Running
alessandro trinca tornidor
commited on
Commit
·
fe7b9b7
1
Parent(s):
89dc4a6
feat: exec an alert with an error message in case of missing TTS voices
Browse files
aip_trainer/lambdas/js.py
CHANGED
@@ -65,9 +65,9 @@ function playAudio(text, language) {
|
|
65 |
voicesSynth = voices.filter(voice => voice.lang.startsWith(language));
|
66 |
}
|
67 |
if (voicesSynth.length === 0) {
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
}
|
72 |
var utterThis = new SpeechSynthesisUtterance(text);
|
73 |
utterThis.voice = voicesSynth[0];
|
|
|
65 |
voicesSynth = voices.filter(voice => voice.lang.startsWith(language));
|
66 |
}
|
67 |
if (voicesSynth.length === 0) {
|
68 |
+
msg = `Error: no voice found for language ${voice_lang} / ${language}, you should use the Text-To-Speech backend feature...`
|
69 |
+
alert(msg)
|
70 |
+
throw new Error(msg)
|
71 |
}
|
72 |
var utterThis = new SpeechSynthesisUtterance(text);
|
73 |
utterThis.voice = voicesSynth[0];
|