(self, model_path)
return model
Load a pretrained Keras model from disk.
        The model must have been saved in the HDF5 format.
        Versions for Python and Keras should match the SSE.
        
        model_path is the path to the model including the file extension if applicable.
        If the model is already locked, wait for a specified number of seconds.
        Retry a maximum number of times before timing out.
Load a pretrained Keras model from disk.
        The model must have been saved in the HDF5 format.
        Versions for Python and Keras should match the SSE.
        
        model_path is the path to the model including the file extension if applicable.
        If the model is already locked, wait for a specified number of seconds.
        Retry a maximum number of times before timing out.
Load a pretrained Keras model from disk . The model must have been saved in the HDF5 format . Versions for Python and Keras should match the SSE . model_path is the path to the model including the file extension if applicable . If the model is already locked wait for a specified number of seconds . Retry a maximum number of times before timing out .
def _get_model_keras(self, model_path):
        """
        Load a pretrained Keras model from disk.
        The model must have been saved in the HDF5 format.
        Versions for Python and Keras should match the SSE.
        
        model_path is the path to the model including the file extension if applicable.
        If the model is already locked, wait for a specified number of seconds.
        Retry a maximum number of times before timing out.
        """

        # Add model directory to the system path
        self._add_model_path(model_path)

        # Lock the model until the tensorflow graph has been setup
        for _ in range(self.retries):
            # If the model is not locked
            if self.__class__.thread_lock is None:
                try:
                    # Set a class variable to lock the model
                    self.__class__.thread_lock = threading.get_ident()

                    # Clear any previous Keras session
                    kerasbackend.clear_session()

                    # Load the keras model architecture and weights from disk
                    model = keras.models.load_model(model_path)
                    model._make_predict_function()
                    break
                finally:
                    # Release the lock, even in the case of any exceptions in the try block
                    if self.__class__.thread_lock == threading.get_ident():
                        self.__class__.thread_lock = None
            else:
                time.sleep(self.wait)
        else:
            raise TimeoutError("The specified model is locked by another thread. If you believe this to be wrong, please restart the SSE. "+\
                "You can also try increasing the number of retries or wait time using the 'keras_retries' and 'keras_wait' arguments.")

        return model
def _get_model_keras ( self , model_path ) : # Add model directory to the system path self . _add_model_path ( model_path ) # Lock the model until the tensorflow graph has been setup for _ in range ( self . retries ) : # If the model is not locked if self . __class__ . thread_lock is None : try : # Set a class variable to lock the model self . __class__ . thread_lock = threading . get_ident ( ) # Clear any previous Keras session kerasbackend . clear_session ( ) # Load the keras model architecture and weights from disk model = keras . models . load_model ( model_path ) model . _make_predict_function ( ) break finally : # Release the lock, even in the case of any exceptions in the try block if self . __class__ . thread_lock == threading . get_ident ( ) : self . __class__ . thread_lock = None else : time . sleep ( self . wait ) else : raise TimeoutError ( "The specified model is locked by another thread. If you believe this to be wrong, please restart the SSE. " + "You can also try increasing the number of retries or wait time using the 'keras_retries' and 'keras_wait' arguments." ) return model