Why do I keep getting Name Error: name ‘model’ is not defined

  python
import numpy as np

from google.colab import files

from keras.preprocessing import image

from matplotlib import pyplot as plt

uploaded = files.upload()

for fn in uploaded.keys():

  path = fn

  img = image.load_img(path, target_size = (150, 150))

  imgplot = plt.imshow(img)

  x = image.img_to_array(img)

  x = np.expand_dims(x, axis = 0)

  images = np.vstack([x])

  classes = model.predict(images, batch_size=10)

  print(fn)

  print(classes)

  if classes[0][0]==1:

    print('Tangan ini menunjukkan BATU')

  elif classes[0][1]==1:

    print('Tangan ini menunjukkan GUNTING')

  elif classes[0][2]==1:

    print('Tangan ini menunjukkan KERTAS')

  else:

    print('TIDAK DIKETAHUI')

Please help

Source: Python Questions

LEAVE A COMMENT