In this post, I’ll make a quick demonstration of how we can effectively use Microsoft Cognitive Services in conjunction with SharePoint.
Through Cognitive Services, we will have the interpretation of images and get their description, for later translation into Portuguese.
Note: The accuracy of the descriptions of the image depends on the cognitive service, so we can not guarantee 100% accuracy in all cases. But overall, it works great.
To start, activate a Free subscription in Microsoft Cognitive Services: https://www.microsoft.com/cognitive-services
Select the “Computer Vision” API for this case. The Free subscription for this API allows 5000 monthly executions with a maximum of 20 per minute, which is enough for the tests.
In my case, I created a library in SharePoint called “Images Database” to store the images, and an “Image Descriptions” list to store the results of the interpretation of Microsoft Cognitive Services and Microsoft Translator.
To begin creating the Flow, start Microsoft Flow, and use the option “Create Flow From Blank”. Select the “Search hundreds of connectors and triggers” option. And then under “SharePoint”, choose the option “When a file is created in a Folder”.
After setting the right site and library folder, we should search for the action “Computer Vision API – Analyze Image”.
Set image source to “Image Content”, and “Image Content” to the file content from the file created in SharePoint.
After that, add a new action, “Translate Text”, targeting your desired language (Portuguese in my case), and another action to create a list item in the Image Descriptions list.
Then set the “Description” field as “Caption Text” from the Analyze Image action results, and set the “Description (Portuguese)” field as the “Translated Text” from the Translate Text action results. These actions are allowed inside a loop for the case you have more than one image analysis result.
Now the Flow setup is complete.
Let’s see the results. Given that we upload this puppy image to the “Images Database” library.
After we upload the image to the library, the flow is run in a while.
The description and translation are added as a new item in the “Image Descriptions” list.
This is a simple sample, but you can see how powerful is all this integration among SharePoint, Flow, Cognitive Services and Translator.