Using tensorflow keras model for predictions in web app

akurmankulov
Level 1
Using tensorflow keras model for predictions in web app

Hello,

I have a tensorflow keras model in the HDF5 file stored in the managed folder. How to load it with the load_model tensorflow.keras.models function in the web app for predictions?

Thank you 

0 Kudos
1 Reply
AlexT
Dataiker

Hi @akurmankulov ,
The recommended approach here would be to deploy a prediction endpoint with that model and call an API endpoint from the webapp 

If the model is not create in DSS you can import it as mlflow model :
https://doc.dataiku.com/dss/latest/apinode/endpoint-mlflow.html
https://doc.dataiku.com/dss/latest/mlops/mlflow-models/importing.html

https://doc.dataiku.com/dss/latest/mlops/mlflow-models/limitations.html

https://doc.dataiku.com/dss/latest/mlops/mlflow-models/importing.html

 

 

Once done you can simply use the dataikuapi to call the endpoint

import dataikuapi

client = dataikuapi.APINodeClient("https://api-xxxx-xx-int2.xxxx.xxxx.com/", "predict")

record_to_predict = {
    "categorical_feature1": "value1",
    "numerical_feature1": 42,
    "categorical_feature2": "value2"
}
prediction = client.predict_record("model-predict", record_to_predict)
print(prediction["result"])

 

0 Kudos

Labels

?
Labels (1)
A banner prompting to get Dataiku