User Review
( votes)In our previous blog, we have seen how to create an Image Classification model by using Microsoft Lobe. Microsoft supports the Image Classification model in Power Apps and Power Automate. In this blog, we will see how we can use the model in Canvas app.
To configure the model in Canvas app, follow the steps given below:
- To export the model, click on the Menu icon and then click on the Export
- Now click on the configure button to configure your CRM instance.
- Give the model a name and then click on the Export button.
- After clicking on the Export button a pop-up would open asking if you want to Optimize & Export the model or simply export the model as it is. I recommend choosing Optimize & Export.
- Once the model is exported you can check the model. To check, open https://make.powerapps.com/ -> Go to AI Builder -> Models.
- Now create a Canvas app. To know more on how to create a Canvas app kindly follow this link.
- Now, we will add our model to our Canvas app. To add the model, click on the Data icon -> Expand AI models section -> If you didn’t find the model then click on the See all models text.
- Once you add the model it would be visible under Data.
- After creating the Canvas app add a Camera control to take images.
- OnSelect event of the Camera control add the below code.
ClearCollect(modelPred, ‘Work Attire Detection’.Predict(MyCam.Photo).Prediction);
- The modelPred is a collection where the prediction would be stored and MyCam is the camera control name and the Work Attire Detection is our model name.
- Now add a Gallery control to show the model prediction result.
- Set the data source to the collection which we created i.e. modelPred.
- Set the Layout to Title only.
- Once this is done you can test the Canvas app to check whether it is working or not.
Conclusion:
In this blog, we have seen how easy it is to use the Image detection model in Canvas app. Based on the Business use case you can provide the images to the model from various places and get the prediction in Canvas app.