Here is my code:
dic = test_dataset.class_indices
idc = {k:v for v, k in dic.items()}
img = load_img( r'C:\Users\sreep\Downloads\Alzheimer_s Dataset\test\NonDemented\26 (62).jpg', target_size = (224,224,3))
img = img_to_array(img)
img = img/255
imshow(img)
plt.axis('off')
img = np.expand_dims(img,axis=0)
answer = model.predict(img)
probability = round(np.max(model.predict(img)*100),2)
print(probability, '% chances are there that the image is',idc[answer[0]])
Error:
TypeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_17688/2364562646.py in <module>
13 probability = round(np.max(model.predict(img)*100),2)
14
---> 15 print(probability, '% chances are there that the image is',idc[answer[0]])
TypeError: unhashable type: 'numpy.ndarray'