Is none check.
This commit is contained in:
parent
f28084750f
commit
928ca39c8c
@ -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 = await session.post(url, headers=headers, json=data)
|
||||||
response_json = await response.json()
|
response_json = await response.json()
|
||||||
audio_content = response_json.get("audioContent")
|
audio_content = response_json.get("audioContent")
|
||||||
|
if not audio_content:
|
||||||
|
return
|
||||||
file = pathlib.Path(str(uuid.uuid4()) + ".mp3")
|
file = pathlib.Path(str(uuid.uuid4()) + ".mp3")
|
||||||
with file.open("wb") as audio_file:
|
with file.open("wb") as audio_file:
|
||||||
audio_file.write(base64.b64decode(audio_content.encode('latin1')))
|
audio_file.write(base64.b64decode(audio_content.encode('latin1')))
|
||||||
|
Loading…
Reference in New Issue
Block a user