Skip to content

Instantly share code, notes, and snippets.

@nmstoker
Created May 13, 2020 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nmstoker/2dbad95a607e32181127b7246dcd863b to your computer and use it in GitHub Desktop.
Save nmstoker/2dbad95a607e32181127b7246dcd863b to your computer and use it in GitHub Desktop.
Example Python code to call Mozilla TTS demo server's API
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