You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
575 B
22 lines
575 B
import time
|
|
from azure.cognitiveservices.speech import SpeechConfig, SpeechRecognizer
|
|
|
|
speech_api_key = '<key>'
|
|
location = '<location>'
|
|
language = '<language>'
|
|
|
|
recognizer_config = SpeechConfig(subscription=speech_api_key,
|
|
region=location,
|
|
speech_recognition_language=language)
|
|
|
|
recognizer = SpeechRecognizer(speech_config=recognizer_config)
|
|
|
|
def recognized(args):
|
|
print(args.result.text)
|
|
|
|
recognizer.recognized.connect(recognized)
|
|
|
|
recognizer.start_continuous_recognition()
|
|
|
|
while True:
|
|
time.sleep(1) |