dataquestio/project-walkthroughs

Name Error

Mahmoudat opened this issue · 1 comments

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

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