'in classify sign = classes[pred] TypeError: unhashable type: 'numpy.ndarray'

enter image description here

Exception in Tkinter callback Traceback (most recent call last): File "C:\python\lib\tkinter_init_.py", line 1921, in call return self.func(*args) File "C:\Users\umutc\PycharmProjects\pythonProject2\main.py", line 189, in classify_b = Button(top, text="Görseli Sınıflandır", command=lambda: classify(file_path), padx=10, pady=10) File "C:\Users\umutc\PycharmProjects\pythonProject2\main.py", line 171, in classify sign = classes[pred] TypeError: unhashable type: 'numpy.ndarray'

# Classifier Function / Sınıflandırma Fonksiyonu
def classify(file_path):
    global label_packed
    image = Image.open(file_path)
    image = image.resize((32, 32))
    image = numpy.expand_dims(image, axis=0)
    pred = model.predict([image])[0]
    sign = classes[pred]
    print(sign)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source