Skip to content

Latest commit

 

History

History
72 lines (41 loc) · 3.24 KB

File metadata and controls

72 lines (41 loc) · 3.24 KB

Azure Computer Vision Sample App

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.

Canvas App Overview

Computer Vision API Connector

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/

Power Automate Flow

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,

Flow Overview

Power Apps Canvas App

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.

Sample Solution

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.

  1. Create a Computer Vision resource in your Azure subscription.

https://azure.microsoft.com/en-us/services/cognitive-services/computer-vision/

  1. Under Keys and Endpoint copy the access key and the endpoint URL for your Computer Vision service.

Azure Setup

  1. Go to your Power Apps environment.
  2. Create a new Connection for the Computer Vision API using the credentials from step 2.

Data Connection Creation

  1. Import the sample ComputerVisionGCC solution file.
  2. You will get prompted which connection you want to use for the Computer Vision API. Select the connection you created in step 4.

Sample Connection Selection

  1. 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.

Ignore Warning

  1. Remove the Power Automate Flow connection.

Remove Flow Connection

  1. Click on the Analyze Image button and remove the existing Flow connection if it shows up.

Remove Flow Connection

  1. Add the Power Apps Azure Gov Computer Vision Flow to the button.

Add Flow Connection

Update the formula bar to include the following syntax,

Set(FlowResponse, PowerAppsAzureGovComputerVisionFlow.Run(Camera1.Photo))
  1. Save and publish the app to use it both in the browser and on your mobile device!