Added timeout for tts

This commit is contained in:
Mathieu 2021-09-14 10:49:20 +02:00
parent 6284b7c2ab
commit f4d24f7eec

View File

@ -26,7 +26,7 @@ def get_audio_from_sentence(sentence):
# TODO : add support for external opentts server # TODO : add support for external opentts server
try: try:
response = requests.get('http://localhost:5500/api/tts', headers=headers, params=params) response = requests.get('http://localhost:5500/api/tts', headers=headers, params=params, timeout=0.2)
return response.content return response.content
except requests.exceptions.ConnectionError: except requests.exceptions.ConnectionError:
print("Error connecting to Open TTS server") print("Error connecting to Open TTS server")