Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.__session = tf.Session(config=self.config, graph=self.__graph)
# with tf.Session(graph=K.get_session().graph, config=self.config) as sess:
self.__emotion_classifier = load_model(emotion_model, compile=compile)
self.__emotion_classifier._make_predict_function()
self.__emotion_target_size = self.__emotion_classifier.input_shape[1:3]
elif "http" in emotion_model:
self.deployment = True
url = os.environ.get("EMOTION_API_URL")
token = os.environ.get("EMOTION_API_TOKEN")
assert (
url is not None and token is not None
), "EMOTION_API_URL and EMOTION_API_URL must set in the environment"
self.__emotion_classifier = Peltarion_Emotion_Classifier(url, token)
self.__emotion_target_size = (48, 48) # Default FER image size
else:
raise Exception(f"{emotion_model} is not a valid type")
logging.debug("Emotion model: {}".format(emotion_model))