This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with SampleAssistant(lang, device_model_id, device_id, | |
conversation_stream, display, | |
grpc_channel, grpc_deadline, | |
device_handler) as assistant: | |
wait_for_user_trigger = not once | |
import snowboydecoder | |
model = 'resources/models/anpanman.pmdl' # アンパンマンのホットワードモデル | |
detector = snowboydecoder.HotwordDetector(model, sensitivity=0.5) | |
print('Listening... Press Ctrl+C to exit') | |
def detected(): | |
detector.terminate() | |
time.sleep(.05) | |
continue_conversation = assistant.assist() | |
wait_for_user_trigger = not continue_conversation | |
detector.start(detected_callback=detected, | |
interrupt_check=interrupt_callback, | |
sleep_time=0.03) | |
def interrupt_callback(): | |
return not wait_for_user_trigger | |
detector.start(detected_callback=detected, | |
interrupt_check=interrupt_callback, | |
sleep_time=0.03) | |
detector.terminate() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment