Skip to Content
Author's profile photo Murali Shanmugham

Try out Machine Learning services on SAP Cloud Platform

SAP Leonardo Machine Learning Foundational APIs have been recently made available in the trial landscape. Anyone can register for a trial account and test drive these ML APIs. In this blog, I want to quickly show you how you get started using the ML APIs to works with the pre-trained models. At SAPPHIRE, the Machine Learning team also announced a set of new pre-trained and customizable services for Face detection, Scene text recognition etc. In the blog, I would like to focus on Scene text recognition which will enable to read text from natural images/scenes. I have been working with several customers who were looking for a similar service to extract text/numbers from images.

I would also like to point to a blog series by Fabian Lehmann  on “Getting started with SAP Leonard ML Foundation on SAP Cloud Platform Cloud Foundry”. Fabian has used a Productive account and shows how to get started as well as covers how to retrain the models and also deploy your own ML models. I would highly recommend going through those blogs.

When registering for a Cloud Foundry trial account, ensure you pick AWS instance as I couldn’t find ML services in Azure/GCP yet.

 

Once you have a Global Account in the Cloud Foundry trial landscape,  verify your entitlements.

You will notice ML Foundation Trial “Standard” service plan is already allocated to this account. Interesting to note that the Blockchain Hyperledger Fabric service is also provided for trial.

Navigate to the Spaces and click on the “Dev” space.

Under Service Marketplace, locate “ml-foundation-trial-beta”

Create a new Instance from the “Instances” menu.

Provide a name of your choice

 

Once the instance has been created, select the instance to go into the details

Create a Service Key form the “Service Keys” menu.

Provide a name of your choice for the service key.

This will give you list of parameters which you will need in order to interact with the ML APIs and build an application. There will be secret keys along with the API endpoints for each of the service. You would be able to test these APIs directly from SAP API Business Hub too.

 

I can test the OCR service by providing an image of a receipt. Below is a receipt which I had from a recent shopping.

I can use POSTMAN Rest Client to pass this image and it would be able to detect the store name, address and the total amount.

 

If you would like to test this using REST Client, please follow the instructions on the setup here – on “Getting started with SAP Leonard ML Foundation on SAP Cloud Platform Cloud Foundry”.

Here is a video which shows how one can build a native mobile app which leverages the above functionality. This android app was built by two interns from SAP Singapore office – Rahul Rajesh & Anusha Anandan in just few days.

I was also curious to find the accuracy of the Scene text ML service. Below is a simple image which shows the house number.

I was able to use the POSTMAN Rest client to test this service with the above image too.

I hope this blog was informative. Go ahead and try these ML APIs on your own and build apps leveraging them.

Assigned Tags

      26 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Yogananda Muthaiah
      Yogananda Muthaiah

      That's really good info to get started

      Author's profile photo Jakob Marius Kjær
      Jakob Marius Kjær

      Murali Shanmugham Legend as always. Good work mate!

       

      Author's profile photo Alexandre Lara
      Alexandre Lara

      Do you have the source code? This demo is amazing.

      Author's profile photo Yashpal Gupta
      Yashpal Gupta

      Hi Murali,

      While creating its say the service is paid. can you comment.

       

      Author's profile photo Murali Shanmugham
      Murali Shanmugham
      Blog Post Author

      You are on trial landscape. Please ignore the message.

       

      Author's profile photo Kashif Bashir
      Kashif Bashir

      Hi, Any idea where can i get "bearer" token?

      I am getting authorization error while trying to post using REST Client.

       

      Br,

      Kashif

       

       

      Author's profile photo Murali Shanmugham
      Murali Shanmugham
      Blog Post Author

      Hi Kashif,

      If you would like to test this using REST Client, please follow the instructions on the setup here – on “Getting started with SAP Leonard ML Foundation on SAP Cloud Platform Cloud Foundry”.

       

      Author's profile photo Kashif Bashir
      Kashif Bashir

      Thanks Alot Murali Shanmugham .

      Indeed another great article by yourself. Thanks for helping me out with seeing it working with POSTMAN. 😉

       

      Br,

      Kashif

      Author's profile photo Ravindra Tanguturi
      Ravindra Tanguturi

      Hi Murali,

      Is OCR changed or same that was in API Hub. As we tried this last year and looking for some capabilities like support for .doc/.docx files and file size of >5 MB etc.....

       

      Best Regards

      Ravindra Tanguturi

      Author's profile photo Murali Shanmugham
      Murali Shanmugham
      Blog Post Author

      Hi Ravindra,

      OCR service (like any other service) has been going through lot of updates. The API Business Hub sandbox service instance only allows documents of up to 2MB, whereas productive instances up to 10MB. The service accepts pdf, jpg and png files types as input and returns detected texts within the file in either text or hOCR format. Hope this helps.

       

      Author's profile photo Rodrigo Francou
      Rodrigo Francou

      Thank you very much for the post, it has helped me a lot. I am interested in knowing how you do to get the image in good shape so that the service can extract the information well. How do you do this process? I see that when you take the photo the app recognizes you the receipt

      Author's profile photo Murali Shanmugham
      Murali Shanmugham
      Blog Post Author

      We need to ensure that the image provided to the ML model is of good quality.

       

      Author's profile photo Sabarna Chatterjee
      Sabarna Chatterjee

      Nice blog Murali.

      I have a question regarding the APIs. Can we create our own APIs with different Machine learning Algorithm any where and access that from POSTMAN?

      Author's profile photo Murali Shanmugham
      Murali Shanmugham
      Blog Post Author

      Its very much possible. One of the key scenarios of the ML platform is to allow the deployment of custom models and expose them as APIs. Once you deploy your own models, you would use the training infrastructure to train the models

       

      Author's profile photo Sabarna Chatterjee
      Sabarna Chatterjee

      Thanks Murali for your input. Can you please provide come of the relative tutorials for same.

      Author's profile photo Saritha Koroth
      Saritha Koroth

      Hi Murali,

      Is it possible to share details on how the android app was developed?

      Regards,

      SK

      Author's profile photo Murali Shanmugham
      Murali Shanmugham
      Blog Post Author

      Sorry, I don’t have access to the app to share the code. I will try and find out from the colleagues who built it

       

      Author's profile photo Mohammed zahid
      Mohammed zahid

      I am getting below error in Window :

      {
      “error”: {
      “code”: “401”,
      “message”: “Unable to authorize the request.: Token error: Access token was not prefixed with token type: Bearer”,
      “requestId”: “76ffd57c-3737-4d61-7f0f-d0cd62a2fe66”
      }
      }

       

      Any resolution to this ?

      I am doing below steps

      1.  copying the image classifier url ( which i get from service key ) and POST it

      This is my first time using postman, could you please explain me how to use

      1. Image classifier url ?
      2. I am able to get the oauth url - access token , now what is next ?
      3. In this blog ( https://blogs.sap.com/2018/01/29/getting-started-with-sap-leonard-ml-foundation-on-sap-cloud-platform-cloud-foundry/comment-page-1/#comment-443997) it is too fast to understand how to get the token and use image classifier .
      Author's profile photo Allan Christensen
      Allan Christensen

      Hi Experts

      Very nice posting! But having some trouble getting the token call to work in postman – i have setup the enviroment using the guide you linked to. can you confirm that for authentication on a trial CF instance i would have to use prefix ‘trial’? and the username is clientid and pass clientsecret?

      I keep getting a "bad credentials" response when trying from postman.

      Cheers Allan

      Author's profile photo Allan Christensen
      Allan Christensen

      Sorry - my bad - got it. For trial url has to be:
      https://<S-User>trial.authentication.eu10.hana.ondemand.com

      Author's profile photo Mohammed zahid
      Mohammed zahid

      Hi,

       

      I am also facing the same issue.

      This might be something with barrier on postman, which is not storing the Oath .

       

      Author's profile photo Mohammed zahid
      Mohammed zahid

      Dear experts,

       

      Why ML application is no longer available in Europe Regions ? Please let me know which region I have to select?? I can see Blockchain applications but not Ml-Foundation .

       

      Please suggest.

       

      Thanks in advance.

      Author's profile photo Uwe Fetzer
      Uwe Fetzer

      No problem here:

      (haven't tested whether the service works or not, just the availability)

      Author's profile photo Mohammed zahid
      Mohammed zahid

      I found what mistake I have did

      When I create a new space i did not assigned it to entitlement section .

       

      This is now resolved.

       

      Thanks you very much.

      Author's profile photo Baron Wang
      Baron Wang

      Hi,

      When I am using SCENE_TEXT_RECOGNITION_URL API .

      Always getting error:

      {
      “error”: {
      “code”: “400”,
      “message”: “Invalid request: “,
      “requestId”: “bd137753-e6aa-4001-6bf8-4779ccab872a”
      }
      }

       

      But another API can work.

      How can I solve it?

       

      Best Regards,

      Baron

      Author's profile photo manel m
      manel m

      Why is no longer ml-foundation-trial-beta? cannot use it