Mert_Dunver:

total_pred = {classname: 0 for classname in classes}





 Mert_Dunver:

                total_pred[classes[label]] += 1





 Mert_Dunver:

accuracy = 100 * float(correct_count) / total_pred[classname]


From these lines, it seems total_pred remained 0 for some class, thus leading to ZeroDivisionError probably.
You can add some print statements and check why this is the case?