Created
May 13, 2020 22:02
-
-
Save nmstoker/2dbad95a607e32181127b7246dcd863b to your computer and use it in GitHub Desktop.
Example Python code to call Mozilla TTS demo server's API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
say_text = input('What should I say?') | |
url = f'http://<REPLACE_WITH_RPI_NETWORK_NAME_IP>:5002/api/tts?text={say_text}' # You will be doing a GET with this format of URL: http://0.0.0.0:5002/api/tts?text=Welcome | |
r = requests.get(url) | |
with open('response.wav', 'wb') as f: | |
f.write(r.content) | |
print('saved wav for {}'.format(url)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment