This demo shows how to integrate Azure Cognitive Services AI/ML services with the Power Platform. Specifically this sample uses the Computer Vision API.
https://azure.microsoft.com/en-us/services/cognitive-services/computer-vision/
This sample works in commercial, GCC, GCC High and DoD environments of Power Platform. This also works with Computer Vision APIs in both commercial Azure and Azure for Government.
This sample uses the Computer Vision API connector which you can read more about in the documentation below,
https://docs.microsoft.com/en-us/connectors/cognitiveservicescomputervision/
In order to response to a button action in Power Apps, I created a Power Automate Flow that takes input parameters from a Power Apps Canvas app. The Flow looks like this,
This app leverages the Power Apps camera control which is built into the platform. It also takes advantage of calling Power Automate Flow from a Canvas app to pass an image to the Azure Computer Vision API.
The end result is a blurb of the Computer Vision API's caption of how it interprets the image.
The sample solution file for this demo can be found below,
Computer Vision Sample Solution
To get this up and running in your environment follow the steps below.
- Create a Computer Vision resource in your Azure subscription.
https://azure.microsoft.com/en-us/services/cognitive-services/computer-vision/
- Under Keys and Endpoint copy the access key and the endpoint URL for your Computer Vision service.
- Go to your Power Apps environment.
- Create a new Connection for the Computer Vision API using the credentials from step 2.
- Import the sample
ComputerVisionGCC
solution file. - You will get prompted which connection you want to use for the Computer Vision API. Select the connection you created in step 4.
- Now you need to edit the Computer Vision Canvas App. Open it up in edit mode. You will get prompted for a connection to Computer Vision. Ignore this warning by clicking "Don't Allow". Once you reconfigure the Power Automate Flow connection in the later steps this will no longer show up.
- Remove the Power Automate Flow connection.
- Click on the Analyze Image button and remove the existing Flow connection if it shows up.
- Add the Power Apps Azure Gov Computer Vision Flow to the button.
Update the formula bar to include the following syntax,
Set(FlowResponse, PowerAppsAzureGovComputerVisionFlow.Run(Camera1.Photo))
- Save and publish the app to use it both in the browser and on your mobile device!