diff --git a/src/rspeech/gcloud.py b/src/rspeech/gcloud.py index 38def7a..8d72ba0 100644 --- a/src/rspeech/gcloud.py +++ b/src/rspeech/gcloud.py @@ -104,6 +104,8 @@ async def tts(text:str ,google_project:str="lisa-448004", language_code:str="nl- response = await session.post(url, headers=headers, json=data) response_json = await response.json() audio_content = response_json.get("audioContent") + if not audio_content: + return file = pathlib.Path(str(uuid.uuid4()) + ".mp3") with file.open("wb") as audio_file: audio_file.write(base64.b64decode(audio_content.encode('latin1')))