# -*- coding: utf-8 -*-
"""
Created on Wed Jul 17 22:33:03 2019

@author: Riad
"""

import cv2
import tensorflow as tf

CATEGORIES = ["Dog", "Cat"]


def prepare(filepath):
    IMG_SIZE = 50  # 50 in txt-based
    img_array = cv2.imread(filepath, cv2.IMREAD_GRAYSCALE)
    new_array = cv2.resize(img_array, (IMG_SIZE, IMG_SIZE))
    return new_array.reshape(-1, IMG_SIZE, IMG_SIZE, 1)


model = tf.keras.models.load_model("64x3-CNN.model")

prediction = model.predict_proba([prepare('dog.jpg')])
print(prediction)  # will be a list in a list.
#print(CATEGORIES[int(prediction[0][0])])
print(prediction[0][0])