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.
- 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 data
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
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.
d. Click New to create Cloud Flow
e. Source: SharePoint
f. It Triggers when an item is created or modified
g. Type in the name flow.
h. To get SharePoint Attachments, add a new action.
- Choose the same Site and list
- The id from the Trigger step should be used.
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.
j. Add action to AI Builder
- Action: Predict
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.
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)
- 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 save
3. Test Image
4. We should be able to observe the outcome in a matter of minutes at most.
5. The end result is as follows:
6. The degree of confidence is 78 percent. To boost confidence, we need to practice with more photos.