import keras
from keras.models import load_model
from PIL import Image
import matplotlib.pylab as plt
import numpy as np
import zipfile
print("Extract")
zip_ref = zipfile.ZipFile("./asset.zip", 'r')
zip_ref.extractall(".")
zip_ref.close()
print("Load Model")
model=load_model("cifar-model.h5")
CIFAR_10_CLASSES=["Plane","Car","bird","cat","deer","dog","frog","horse","ship","truck"]
def calc(imname):
    test_image =Image.open("asset/"+imname)
    test_image=test_image.resize((32,32),Image.ANTIALIAS)
    test_image=np.array(test_image,dtype="float32")
    test_image/=255
    test_image=test_image.reshape(-1,32,32,3)
    predictions=model.predict(test_image)
    index_max_pred=np.argmax(predictions)
    plt.title("Complete: {}".format(CIFAR_10_CLASSES[index_max_pred]))
    plt.imshow(test_image[0].reshape(32,32,3))
    print(predictions)
    plt.show()
print("START TEST")
calc("lkw-image.jpg")
calc("cat.jpg")
calc("frog.jpg")
calc("fog.jpg")
calc("lfog.jpg")
calc("d.jpg")
calc("b.jpg")
calc("bs.jpg")
calc("plapper.jpg")
calc("ds.jpg")
print("Complete")
print("End")
quit(0)

[((8, 10, 8, 45), 'zipfile.ZipFile', 'zipfile.ZipFile', ({(8, 26, 8, 39): '"""./asset.zip"""', (8, 41, 8, 44): '"""r"""'}, {}), "('./asset.zip', 'r')", False, 'import zipfile\n'), ((12, 6, 12, 34), 'keras.models.load_model', 'load_model', ({(12, 17, 12, 33): '"""cifar-model.h5"""'}, {}), "('cifar-model.h5')", False, 'from keras.models import load_model\n'), ((15, 16, 15, 43), 'PIL.Image.open', 'Image.open', ({(15, 27, 15, 42): "'asset/' + imname"}, {}), "('asset/' + imname)", False, 'from PIL import Image\n'), ((17, 15, 17, 51), 'numpy.array', 'np.array', (), '', True, 'import numpy as np\n'), ((21, 19, 21, 41), 'numpy.argmax', 'np.argmax', ({(21, 29, 21, 40): 'predictions'}, {}), '(predictions)', True, 'import numpy as np\n'), ((25, 4, 25, 14), 'matplotlib.pylab.show', 'plt.show', ({}, {}), '()', True, 'import matplotlib.pylab as plt\n')]