#Objective of this file is to analyse a face
import keras
import numpy as np
import cv2
from utils import *
from config import emotions, input_shape, modelName

#model = tf.keras.models.load_model("models/"+modelName)	#Load our model
model = tf.saved_model.load("models/"+modelName)

print('Model used:', modelName)

def detectEmotion(face):
	#Return the most likely emotion there is on a face
	
	face = normAndResize(face, input_shape)		#Process our image for input of model

	emotionVect = predir(model, face)
	emotionNbr = np.argmax(emotionVect)			 
	emotion = emotions[emotionNbr]
	return emotion