Introduction
In this article, you will see how to generate a description of an image using Cognitive Service and Microsoft Flow. A button will be used to trigger the flow manually and it will take the input as image file. With the help of Computer Vision API (it uses the "Describe Image" action) connector, the description of an image will be generated and will be shown as a mobile notification.
Flow Design
Get Subscription Key
- Navigate to Azure Portal here.
- In the left navigation, click "Create a resource".
- In Azure marketplace, select "AI + Machine Learning" and then, click Computer Vision.
- Enter the required details, as shown below and click "Create".
- It might take a few minutes to deploy the resource. Click "All Resources" in the left navigation and then click the newly created computer vision resource.
- Click Keys under Resource Management, and copy the Key value.
- Click "Overview" and copy the endpoint.
Create Flow
- Navigate to the flow site here.
- In the top navigation, click "My flows".
- Click "Create from blank".
- Select "Manually trigger a flow" >> Add an input. Then, select the user input as File as shown below.
- Click "Next Step" and search for Computer Vision as shown below. Select the "Describe Image" option.
- Enter the following details and click "Create".
- Connection Name – a user-friendly name for the connection
- Account Key – Copied from the above Get Subscription Key section
- Site URL – Copied from the above Get Subscription Key
- Select Image Content for Image Source drop-down. Select the dynamic content as File Content for Image Content.
- Click "Next Step" and search for notification as shown below. Select "Send me a mobile notification".
- Select the dynamic content "Captions Caption Text" for the text field, as shown below.
- Enter the title for the flow and click on "Save".
Test the Flow
- Open Flow mobile app.
- Click on Buttons. Click "Describe Image".
- Capture the image using a mobile camera or upload the image from the gallery. Once the image is uploaded, click "Done".
- After a few seconds, a notification will be received that provides the description of an image that was uploaded.
Summary
Thus, in this article, you saw how to generate a description of an image using Cognitive Service and Microsoft Flow.