SimilarProduct Insight not working in visual search API

Martin Meyer 0 Reputation points
2024-11-06T23:34:23.5533333+00:00

Hi

i have this trying to find similiar products for an image of an product. Following the documentation
i just need put "SimilarProducts" in the invodedSkills of the api call
but i not get any answer with this code

endpoint = "https://api.bing.microsoft.com/v7.0/images/visualsearch"

image_url = "https://m.media-amazon.com/images/I/71CBk3JtF6L.__AC_SY300_SX300_QL70_ML2_.jpg"

# Specify the image insights token
knowledge_request = {
    "imageInfo": {
        "url": image_url  # Provide the URL of the image you want insights for
        #"imageInsightsToken": "ccid_cixTCTqz*cp_D7F0A068A89FA15BECFF781E1353DC4F"

    },
    "knowledgeRequest" : {


    "invokedSkills": ["SimilarProducts"],
    
}

    }


# Set the unique boundary
boundary = "boundary_1234abcd"

# Prepare the headers with multipart form-data
headers = {
    "Ocp-Apim-Subscription-Key": subscription_key,
    "Content-Type": f"multipart/form-data; boundary={boundary}"
}

# Format the multipart form-data body
body = (
    f"--{boundary}\r\n"
    f"Content-Disposition: form-data; name=\"knowledgeRequest\"\r\n\r\n"
    f"{json.dumps(knowledge_request)}\r\n"
    f"--{boundary}--"
)

# Send the POST request
response = requests.post(endpoint, headers=headers, data=body)

i get this response for an amazon product image

{"_type": "ImageKnowledge", "instrumentation": {"_type": "ResponseInstrumentation"}, "tags": [{"displayName": "", "actions": []}], "image": {"imageInsightsToken": "ccid_cixTCTqz*cp_D7F0A068A89FA15BECFF781E1353DC4F"}, "debugInfo": {}}

Bing Visual Search
Bing Visual Search
A Bing service that gives you rich insights to help build compelling image applications on the device of your choice.
25 questions
{count} votes

1 answer

Sort by: Most helpful
  1. navba-MSFT 26,115 Reputation points Microsoft Employee
    2024-11-30T06:41:19.24+00:00

    @Martin Meyer Thanks for sharing the details in private message. Due to the complexity of this issue, we may need a Support ticket to have a closer look at this issue.

    .

    After initial investigation on this issue, I have helped enable a one-time, courtesy free support flag on your subscription ‘428eXXXX-XXXX-XXXX-XXXX-XXXXacc7f7c3’ for a quick and immediate assistance. 

    Please create a service request to formally track this issue. This helps us track widespread impact in the event other customers are experiencing similar issues.

    .

     

    Details on how to raise a service request below: 

    •            Go to the Health Advisory section within the Azure Portal: https://aka.ms/healthadvisories 

    •            Select the Issue Name "You have been enabled for one-time Free Technical Support"

    •            Details will populate below in the Summary Tab within the reading pane and you can click on the link "Create a Support Request" to the right of the message

     

    .

    Also once you have a resolution on this, please post it here so that it benefits other community audience.

    .

    **

    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.