This is my Python Script:
from gtts import gTTS from playsound import playsound message = 'I'm Happy' language = 'en' speech = gTTS(text = message, lang = language, slow=False) speech.save('test.mp3') playsound('test.mp3') print('Hi')
My goal is simple, I want it to be executed whenever I click a button in html. I've read that Ajax is needed to accomplish this. However, the script is different from other questions here, the others wanted to retrieve text from the python script; mine attempts to use google translate voice to say 'I'm happy'.
Alternatively, if I can make this happen through PHP, can I know how?