Test-AI-Model
About the Author: Manish Luhana
Microsoft business applications specialist and certified trainer.
Categories: AI Builder, Power Platform0 CommentsPublished On: 29 March 2022

We covered how to train and publish the object detection AI model in another blog. This blog will go through how to use the AI model in a real-world situation.

Add-AI-Predict

  • We’ll submit the input from SharePoint in our demonstration.
  • A user must first build a list item and then upload the image to SharePoint.
  • The Power automate flow will be activated next.
  • The next step is to deliver the data or file content to the AI Model via Power automation.
  • The result/output is returned by the Next AI model.
  • Finally, Power automates the modification of the result in the SharePoint List, allowing us to double-check the dataData-Flow

How to use Power Automate to consume AI models step by step

1. Generate a SharePoint list with the fields listed below. These are the picture and AI objects/data elements that will be collected.

a. Soccer Ball Count – Integer

b. Confidence – Decimal

c. Analyze Complete – Boolean

 

SP-List-New-Fields

2. Develop automated cloud flow

a. Go to https://make.powerapps.com to get started.

b. Choose a suitable setting.

c. Make a new solution (If not exist already)

Note: There are some limitations in the default setting.

Create-Solution

d. Click New to create Cloud Flow

New-Cloud-Flow

e. Source: SharePoint

f. It Triggers when an item is created or modified

Select-Trigger

g. Type in the name flow.

When-New-Item-Created

h. To get SharePoint Attachments, add a new action.

  • Choose the same Site and list
  • The id from the Trigger step should be used.

Get-Attachments

I. Add an action to access the content of a SharePoint file.

  • Choose the same site.
  • The ‘Id’ from the “Get attachments” step should be used as the File Identifier.

Get-File-Content

j. Add action to AI Builder

  • Action: PredictAdd-AI-Predict-1

k. Choose your AI model for object detection that we trained in our previous article.

  • Set the image from Step #9 as the file content.File-Contant-to-AI-Model

l. Add a SharePoint action to update an item.

  • Source: SharePoint
  • Action: Update Item
  • From the trigger, set the Id and Title.
  • Update other fields
  • Soccer Ball Count
  • Formula: length(outputs(‘Predict’)?[‘body/responsev2/predictionOutput/results’])
  • Confidence %: mul(items(‘Apply_to_each_2’)?[‘confidence’],100)
  • Analyze Complete – This is to avoid recursive (infinite loop)Update-SP-Item
  • Because we may gather or anticipate several objects from the same image, another “Apply to each 2” has been included.
    m. Put the AI Model to the Test
  • To create a list in SharePoint,
  • Go to the Add List item
  • Click saveAdd-Item-in-SP

3. Test Image

Test-1

4. We should be able to observe the outcome in a matter of minutes at most.

5. The end result is as follows:

Final-Result

6. The degree of confidence is 78 percent. To boost confidence, we need to practice with more photos.

tech mentor sidebanner
  • Continue reading
  • Continue reading
  • Continue reading
  • Continue reading
  • Continue reading

Leave A Comment