def speak(text): """ Speech given text @param text : string """ synthesizer = select_synthesizer() synthesizer.say(text) return 'OK'
def decorated_function(*args, **kwargs): callback = request.args.get('callback', False) if callback == 'tts': data = func(*args, **kwargs).data if data == '' or not isinstance(data, str): data = "Nothing to say!" synthesizer = select_synthesizer() synthesizer.say(data) return ('', 204) else: return func(*args, **kwargs)