Skip to Content

PS: Live demo app video at the end of the blog.

SAP Community is all about inspiring each other and this is the reason for this blog. I got inspired by an ABAP blog where Ajay Rawat showed us how to use ABAP to consume image classification services of SAP Leonardo. I thought of trying out language detection services via a hybrid app.

One of the important thing which I would like to point out is the development time has reduced drastically. It took me only 1 hour or so to set up everything. SAP Cloud Platform actually is reducing the time to production bring agility to SAP. It is like plug and play whatever you want you choose, integrate, customize and boom you are good to go.

Development steps

  • So, the first thing to be done was to get the API key which will be used while consuming the SAP Leonardo Machine Learning Language services API. Good thing about all the API’s is they more or less have consistent structure, all you need is a API key and the structure in which data is to be passed, you are good to go.

  • Next was getting our Ionic hybrid app to pass our input data to the API. Being a huge fan of ionic, created a basic form-based app with below mentioned fields to keep the app generic so that you all can use it.
    • Enter ML Api
    • Enter API key
    • Paragraph for which language to be determined
    • Determined language

  • Sample code for API call via Ionic
start(){
    let headers = new Headers();
    headers.append( 'Content-Type','application/json');
    headers.append( 'Accept','application/json');
    headers.append('APIKey',this.sapcp.APIKey);
    var myData = JSON.stringify( {"message":this.sapcp.lang});
    var link =this.sapcp.url;
    this.http.post(
      link,myData,{headers:headers}) .subscribe(data => {
        console.log(data);
        this.sapcp.detLang = data.json().langStr;
        }, error => {
        console.log(error);
        });
 } 

Technology Stack Used

  • SAP API Hub Service – Leonardo Machine Learning – Language Detection Services
  • Ionic Framework

Live Demo

I hope demo makes more sense than my blog

What is next?

  • Extend this Android based app to be like a testing ground for different ML services.
  • Image recognition via App

Seriously once you see this mobile integrating with Cloud, Big data, AI etc. working it feels just awesome. I am thinking of streaming my laptop sensor/battery data to SAP Cloud IoT also😊

Too many ideas, lets share and learn.Feel free to provide your feedback,open to all ears:)

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply