Organizations are using AI( Machine Learning ) models more often to extract insightfull information from their data in today's data driven world. When combined with SAP HANA cloud DB, SAP Business Technology Platform( SAP BTP ) provides capability for deploying ML Models.
In this Post, we will look at how to integrate a python ML model using Flask application using Data from SAP HANA cloud DB and deploy it on SAP BTP.
SAP BTP Trial Account
SAP Business application studio or python IDE with CF CLI
Authorization and Trust management in SAP BTP
SAP HANA Cloud Service
HANA Cloud DB
Create a HANA Cloud DB instance and create a table to store all the historical data. Copy the SQL endpoint, which can be used to call the FB instance from the python application
Python Application Structure:-
Flask Application file
Create a python file to call the data from HANA DB , pass the data to the ML Model in the Pickle file and expose it as a FLASK API.
Pass the SQL endpoint to address and port, ID and password of the Hana DB instance
This file contains all the libraries required to run the application
This contains the runtime environment details
This file is read by BTP deployer, used to deploy the application. Add all the backing services, along with the buildpack details for deployment. I have added Hanacloud service details to bind the HANA DB instance with the application
Please Note: For training the Model I have used a CSV file with data and generated a trained model ,saved it to a pickle file. Training can also be done using live data from HANA DB
Deployment of the application
In the terminal in SAP BAS, login to CF using CLI available
Use command CF Push to push the application to SAP BTP
From this blog, we have learned how to quickly develop and manage ML Models over SAP BTP. Hope, this will help train & develop ML Model to quickly get insights from data.
Thank You! and let me know if you need more details.