As I was waiting to pick up my online order in one of the clothing retail store, there was a digital screen at the back of the pick up counter which displayed the new arrivals of the season. While waiting around 10 minutes to pick up my order, I had an epiphany of smart display where the screen would display the new arrivals that would be relevant to whoever is looking at the screen. This gave me a fun idea of trying out ‘Smart Advertising’ using SAP Cloud Platform.
This is definitely not a new innovation and there are so many retailers who are already using this type of advertising. This blog explains how you can quickly develop a rough prototype of smart advertising using SAP Cloud Platform. The picture below depicts a sample high level architecture to achieve this.
Following are the pre-requisites.
- A trial account in SAP Cloud Platform (Neo) (http://account.hanatrial.ondemand.com)
- ‘Open Connectors’ service is enabled in your trial account. Refer https://blogs.sap.com/2018/09/19/part-1-enable-sap-cloud-platform-open-connectors-in-trial/ for the steps.
- Azure free account with a resource created for ‘cognitive services’.
You can set up the open connectors to connect to Microsoft Cognitive Services and consume it directly in a SAP UI5 application by following this blog. Refer this blog by Divya Mary to consume the data from open connectors through API Management in a SAP UI5/Fiori application
When I did the prototype by following the steps as above, it worked fine but it was not realistic. If you notice the code snippet in the blog, the data sent to the Face API is in the form of url. The image captured by the webcam should be stored and the url is to be sent in the JSON data to the Face API. Face API also accepts image as binary, which can be easily streamed from the webcam output. But Open Connectors does not seem to support content type of ‘application/octet-stream’ in request headers.
I tried replacing the content-type in the header to ‘application/octet-stream’ in the set up step. You can see that the drop down list has only two options by default – application/json and application/xml. But the data got corrupted and Face API was not able to read the data. This seems to be a restriction from the Open Connector service.To make my fun project realistic, I had to make the Face API call directly from the UI5 application by passing the data as application/octet stream.
The application is designed to display a random list of clothing items. If the camera recognises that someone is viewing the application, it displays the items that would interest the age group of the viewer.
Have a look at this video for a short demo. You can see the products being displayed depending on who is in front of the screen.