Vosk speech recognition multiprocessing reloading error

71 views Asked by At

i have a code for speech recognition, now i want to add "Stop" phrase, so only way to stop is to do multiprocessing with shotdown processes. code is big, but problem is in this functions: '

def thread_process(voice):
    cmd = filter_cmd(voice)
    if (cmd['cmd'] in config.VA_CMDS):
        execute_cmd(cmd)
    else:
        tts.play_sound('not recognized')

def va_respond(voice: str):
    print(voice)
    if voice.startswith(config.VA_ALIAS):
        tts.play_sound('request accepted')
        child_process = multiprocessing.Process(target=thread_process,args=(voice,),daemon=True)
        child_process.start()

stt.va_listen(va_respond)
'

every time when new process is created, vosk model reloading

i expect to multiprocessing work correct, i want to stop other processes when vosk recognize "stop" phrase.

0

There are 0 answers