Using tensorflow keras model for predictions in web app
akurmankulov
Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1 ✭
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
Answers
-
Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,226 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.htmlhttps://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"])