cancel
Showing results for 
Search instead for 
Did you mean: 

How to consume ML services from SAPUI5

former_member253880
Participant
0 Kudos

Hello,

I like to consume the SAP Leonardo ML service

"/scene-text-recognition" from my SAPUI5 app.

But I don't know how to fill the "oData" parameter in loadData method.

oModel.loadData("https://sandbox.api.sap.com/ml/scenetextrecognition/scene-text-recognition", oData, true, "POST", null, false, sHeaders);


How does the odata payload looks like?

Thanks in advance.

Kind regards

Axel

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member253880
Participant
0 Kudos

Hi Gregor,

thanks for the fast reply.

Of course I checked the description of the service first, but I only found for the following part about the request payload

files * file (formData)

Image from which to extract texts. Please provide a single color image file having dimensions equal or greater than 64 pixels. **

    Accepted file extensions:

  • Image file: jpg jpe jpeg png**
  • I also tested sucsessfully the "javascript" approach, but would it be not better to use the SAPUI5 approach in a SAPUI5 app?

    The formData object looks like this:

    data.append("files", "<file_contents>", "<filename>");

    and the oData?

    { files: { content: <file_content>, name: <filename> } }

    Thanks,

    Axel

    gregorw
    Active Contributor
    0 Kudos

    I would suggest that you have a look at the description of the service at:

    https://api.sap.com/api/scene_text_recognition_api/resource

    also you should check the JavaScript example that is provided when you click "Code Snippet".