cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
diegolin
Level: Powered On

Re: Problem with ComputerVisionAPI (Microsoft Cognitive Services) - "InvalidImageUrl"

Understanding the problem and a lot of reading, the problem is powerapps base64 image-format and all api, endpoints from computervision API, sharepoint, onedrive etc. are expecting binary file format.

Supriya191
Level: Powered On

Re: Problem with ComputerVisionAPI (Microsoft Cognitive Services) - "InvalidImageUrl"

@steeleyj Thanks for your suggestion. Can you please tell what are the parameters you are passing from powerapps to Azure function with an example. I am not able to pass the image url from my custom image gallery.

Super User
Super User

Re: Problem with ComputerVisionAPI (Microsoft Cognitive Services) - "InvalidImageUrl"

I got the ComputerVisionAPI (v2) working directly in PowerApps (without using FLOW) but only for describing (tagging) images.

 

The ComputerVisionAPI command DescibeImageContent will take as an argument the image property from the Add Picture control as follows:

 

ClearCollect(colImageDesc, ComputerVisionAPI.DescribeImageContent(UploadedImage2.Image).description)

This returns a table with a single row (I guess as a single image was submitted) with two columns - 'captions' and 'tags'. Each of the two columns contain an embedded table. In the code above I am capturing the returned table in a collection 'colImageDesc'.

 

Captions is a table that contains a single row with two columns: 'confidence' and 'text' where 'text' is a description/caption for the image and 'confidence' is a % representing how likely it is that the descption/caption is correct.

 

To display the caption, you can add a label with the following formula for the Text property (take the first row from colImageDesc, take the captions value (a table) then take the first row from the captions table and the entry from the text column).

 

First(First(colImageDesc).captions).text

To show the confidence, add another label with the following formula for the Text property:

Round(First(First(colImageDesc).captions).confidence,2)

I've used a round function to limit the display to just 2 decimal places.

 

Tags is a single column 'value' with multiple rows and lists tags (person, car, beach, etc.) representative of the image. There is no confidence rating returned, but it seems to list the tags from 'better' (most confident) to 'worse' (least confident).

 

An easy way to display this is to add a datatable and set the Items property as follows:

First(colImageDesc).tags

Given that the tags appear to be listed from 'most likely to apply to least likely to apply' you could use a FirstN function to limit to the first 5 results or so.

 

All the other ComputerVision commands appear to require 'format' and 'string' as arguments and as others here have found, there appears to be no way to pass these arguments directly from PowerApps in a way that the ComputerVision API will accept. 

 

Fingers crossed for an update to PowerApps and/or ComputerVision to get more of the commands (especially OCR, I can see a lot of potential applications for that) working within PowerApps without resorting to FLOW, Azure Functions, etc.

 

Hope this info helps someone.

Paul

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 258 members 5,091 guests
Please welcome our newest community members: