0

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?

3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.