Technical Articles
UI5 App for the SAP Leonardo Machine Learning Service
The current version of the Machine Learning service in the SAP Cloud Platform only provides an API based interface to communicate with this service. For that reason, I’ve created a very basic UI5 app for managing and maintain the Image Classifier and the Image Retraining API of the SAP Leonardo Machine Learning Service.
Why
We have been using the SAP Leonardo Machine Learning Service very actively for some projects and proof of concepts lately. During these projects, we have been using the retraining API and created multiple retraining jobs. These retraining jobs resulted in models that we have been deploying and un-deploying to the Machine Learning Service to test the retrained models. For all of these steps, SAP only provides a swagger UI interface.
Swagger UI provides you a basic UI interface that helps you to use the Machine Learning Service API. Which is totally fine for us but sometimes hard to use by the customer to maintain the models. (We’ve also noticed that fetching the bearer token not always worked correct… )
Besides the very technical UI, you also pay for each hour that a model is running/deployed (depending on the license model you choose). (a model needs to be running to access it) In some cases, you could save money if the model is not running 24/7. In case of our PoC’s, it only needed to run for several days and we had to turn it on and off frequently. A basic app made this easy for us.
Solution
Open the app (no user required): https://machinelearning-a483177cd.dispatcher.hana.ondemand.com/index.html?hc_reset
When the app starts, it only contains a text area. In this text area, you need to provide your Machine Learning Service Keys. Just copy them from CloudFoundry:
And past it here
From the moment that you paste the “Service Keys” in the config field, it will load all the models and jobs. Based on the “Service Keys”, the app will detect if you’re using the Machine Learning service on a trial or productive account and use different destinations:
You can now start every model by clicking on the play button and you’ll see an instance coming up. You can stop each instance by clicking on the stop button.
It can take a few seconds/minutes before a model is deployed. You can use the refresh button the check if the status has been updated:
Once a model is deployed and ready to serve, you can test it immediately at the bottom of the same app:
Select the model in the dropdown, upload a picture and you’ll see the result:
You can also start a new retraining job from in this app in the “Jobs” section. Click on the “play” button and fill in the job config (same json object as in swagger UI) and hit play again.
Currently there is no option to stop a running job.
Try it
The app is available on: https://machinelearning-a483177cd.dispatcher.hana.ondemand.com/index.html?hc_reset
It will automatically detect a trial or productive account and select the right destination. (Only tested with productive one)
In case you want to run it on your own account or help improving it, the code is available on GitHub: https://github.com/lemaiwo/MachineLearningUI
You can find the required destination at the bottom.
You’re always welcome to help improving it.
Technically
The app is created with the following concept: https://blogs.sap.com/2018/10/01/reactive-programming-with-ui5-managedobjectmodel/
In combination with: https://blogs.sap.com/2018/09/17/ui5-odata-requests-with-promises/
Destinations
The app uses the following destinations:
Hi Wouter,
nice blog and awesome that you make the code available via Github! I'll definitely try it out myself.
Could you please export the destinations and provide the file here? This would make it easier for people to import them 🙂
Regards,
Marius