I am using flask framework to interface a text-to-speech system to web. Basically website takes input via textbox and returns a audio file. Once text is entered into text box and a button is pressed below call-back will be invoked.
def task_text2speech():
# call to my text to speech system
# respond to client
In above above function step "# call to my text to speech system" will take around 30-100 seconds. During this time client browser will not have any response. I want to overcome this by starting a thread instead of blocking task_text2speech in task_text2speech and once thread is done with speech synthesis respond to client.
For me implementing threading is not a issue, but I am not aware of flask handlers required to respond to client in above scenario. Any docs or example implementation are appreciated.