Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Chiranjeevi1
Explorer

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.

Prequiste:

  1. SAP BTP Trial Account
  2. SAP Business application studio or python IDE with CF CLI
  3. Authorization and Trust management in SAP BTP
  4. 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

Chiranjeevi1_0-1706683842120.png

Chiranjeevi1_1-1706683997242.png

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

Chiranjeevi1_2-1706684734542.png

Requirements.txt

This file contains all the libraries required to run the application

Chiranjeevi1_3-1706685039193.png

Runtime.txt

This contains the runtime environment details

Chiranjeevi1_4-1706685121982.png

 

Manifest.yaml

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

Chiranjeevi1_8-1706686543697.png

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

Chiranjeevi1_5-1706685703020.png

Use command CF Push to push the application to SAP BTP

Chiranjeevi1_7-1706686104166.png

Conclusion

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.

References

  1. Create a application with cloud found python Build Pack
  2. Deployment of Python Application on BTP for API Integration & Creation
 

 

 

 

Labels in this area