dataquestio / project-walkthroughs

Data science, machine learning, and web development project code for https://www.youtube.com/c/Dataquestio .
954 stars 1.11k forks source link

Name Error #2

Closed Mahmoudat closed 2 years ago

Mahmoudat commented 2 years ago

Hi,

I've followed the same code but I keep getting this error.

NameError Traceback (most recent call last) Input In [1], in <cell line: 4>() 1 FRAME_RATE = 16000 2 CHANNELS = 1 ----> 4 model = Model(model_name="vosk-model-en-us-0.22") 6 rec = KaldiRecognizer(model, FRAME_RATE) 7 rec.SetWords(True)

NameError: name 'Model' is not defined

I've tried defining the file path but the error is the same.

NameError Traceback (most recent call last) Input In [7], in <cell line: 4>() 1 FRAME_RATE = 16000 2 CHANNELS = 1 ----> 4 model = Model(r"C:/Users/mahmoudatsanni-oba/cache.vosk/vosk-model-small-en-us-0.15") 6 rec = KaldiRecognizer(model, FRAME_RATE) 7 rec.SetWords(True)

NameError: name 'Model' is not defined

VikParuchuri commented 2 years ago

This would happen if you haven't imported the Model class. You need to run from vosk import Model, KaldiRecognizer