Hi i'm new to programming and i am facing this issue where the labels are not updated only until the synthesize function is completed. Should i look into async programming to solve this issue?
self.responseText.config(text = res) and self.changePic(responseImagePath) are to change the label properties. Thanks.
def chatBot(self):
audio_source.is_recording = True
# STT
stream.start_stream()
recognize_using_websocket()
# ASSISTANT
message = assistant.message(
assistant_id = CONFIG["assistant"]["assistant_id"],
session_id = session,
input = { 'text': recordedInput }
).get_result()
print(message)
res = message["output"]["generic"][0]["text"]
self.responseText.config(text = res)
print("Response: " + res)
if imagePresence(message) == True:
responseImagePath = message["output"]["generic"][1]["source"]
print("Response Image src: " + responseImagePath)
self.changePic(responseImagePath)
# TTS
test_callback = MySynthesizeCallback()
tts.synthesize_using_websocket(
res,
test_callback,
accept = "audio/wav",
voice = "en-US_AllisonVoice"
)