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
545 B
22 lines
545 B
3 years ago
|
import time
|
||
|
from azure.cognitiveservices.speech import SpeechConfig, SpeechRecognizer
|
||
|
|
||
|
api_key = '<key>'
|
||
|
location = '<location>'
|
||
|
language = '<language>'
|
||
|
|
||
|
speech_config = SpeechConfig(subscription=api_key,
|
||
|
region=location,
|
||
|
speech_recognition_language=language)
|
||
|
|
||
|
recognizer = SpeechRecognizer(speech_config=speech_config)
|
||
|
|
||
|
def recognized(args):
|
||
|
print(args.result.text)
|
||
|
|
||
|
recognizer.recognized.connect(recognized)
|
||
|
|
||
|
recognizer.start_continuous_recognition()
|
||
|
|
||
|
while True:
|
||
|
time.sleep(1)
|