title: NameError: name 'model' is not defined in python code for isolated speech recognition
body: <p>I downloaded the code from <a href="https://github.com/prakashpandey9/IsolatedSpeechRecognition" rel="nofollow noreferrer">https://github.com/prakashpandey9/IsolatedSpeechRecognition</a></p>
  
  <p>That code was compatible with Python 2 and I wrote it for Python 3.</p>
  
  <p>But I m getting this error:</p>
  
  <pre><code>~/Desktop/IsolatedSpeechRecognition-master $ python Isolated_Speech_Recognition.py 
      List of spoken words: ['dog', 'human', 'god', 'eye', 'book', 'fast', 'apple', 'cat']
      {'book', 'human', 'fast', 'apple', 'god', 'cat', 'dog', 'eye'}
      Number of total files: 120
      Labels and label indices [6. 6. 6. 6. 6. 6. 6. 6. 6. 6. 6. 6. 6. 6. 6. 1. 1. 1. 1. 1. 1. 1. 1. 1.
       1. 1. 1. 1. 1. 1. 4. 4. 4. 4. 4. 4. 4. 4. 4. 4. 4. 4. 4. 4. 4. 7. 7. 7.
       7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
       0. 0. 0. 2. 2. 2. 2. 2. 2. 2. 2. 2. 2. 2. 2. 2. 2. 2. 3. 3. 3. 3. 3. 3.
       3. 3. 3. 3. 3. 3. 3. 3. 3. 5. 5. 5. 5. 5. 5. 5. 5. 5. 5. 5. 5. 5. 5. 5.]
      (120, 3841)
      Processed observation 0
      Processed observation 10
      Processed observation 20
      Processed observation 30
      Processed observation 40
      Processed observation 50
      Processed observation 60
      Processed observation 70
      Processed observation 80
      Processed observation 90
      Processed observation 100
      Processed observation 110
      (120, 7, 33)
      Traceback (most recent call last):
        File "Isolated_Speech_Recognition.py", line 269, in &lt;module&gt;
          _ = [model.train(X_train[y_train == y, :, :]) for m, y in zip(ms, ys)]
        File "Isolated_Speech_Recognition.py", line 269, in &lt;listcomp&gt;
          _ = [model.train(X_train[y_train == y, :, :]) for m, y in zip(ms, ys)]
      NameError: name 'model' is not defined
  </code></pre>
  
  <p>this is the code snippet where I m getting error:</p>
  
  <pre><code>from sklearn.model_selection import StratifiedShuffleSplit
  sss = StratifiedShuffleSplit(test_size=0.1, random_state=0)
  
  for n,i in enumerate(all_obs):
      all_obs[n] /= all_obs[n].sum(axis=0)
  
  
  for train_index, test_index in sss.split(all_obs, all_labels):
      X_train, X_test = all_obs[train_index, ...], all_obs[test_index, ...]
      y_train, y_test = all_labels[train_index], all_labels[test_index]
  ys = set(all_labels)
  ms = [gmmhmm(7) for y in ys]
  
  _ = [model.train(X_train[y_train == y, :, :]) for m, y in zip(ms, ys)]
  ps1 = [model.test(X_test) for m in ms]
  res1 = np.vstack(ps1)
  predicted_label1 = np.argmax(res1, axis=0)
  dictionary = ['apple', 'banana', 'elephant', 'dog', 'frog', 'cat', 'jack', 'god', 'Intelligent', 'hello']
  spoken_word = []
  for i in predicted_label1:
      spoken_word.append(dictionary[i])
  print(spoken_word)
  missed = (predicted_label1 != y_test)
  print('Test accuracy: %.2f percent' % (100 * (1 - np.mean(missed))))
  </code></pre>
  
  <p>I tried but not able to find why I am getting this error and how to resolve this.</p>