Custom Vision Prediction Results

#DENVERSON TAN JING WEI# 1 Reputation point
2020-12-19T19:45:32.77+00:00

Hi all,

I am trying to create a classifier in React Native that classifies image using an image url. I am able to send the image to my prediction endpoint. However, I am unable to retrieve the prediction results.

https://imgur.com/a/OHKLbeX

Above link is my code.

Azure AI Custom Vision
Azure AI Custom Vision
An Azure artificial intelligence service and end-to-end platform for applying computer vision to specific domains.
235 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. romungi-MSFT 43,696 Reputation points Microsoft Employee
    2020-12-21T07:46:46.407+00:00

    @#DENVERSON TAN JING WEI# Does your prediction endpoint respond when you try to classify directly from the custom vision portal?
    I am not really an expert at using react native but the implementation mentioned here seems to work according to the author. Could you try something similar with your implementation if the prediction API works directly from the portal?

        async sendToMicrosoftPrediction(img_url) {  
            let response = await fetch(PREDICTION_URL, {  
                method: "POST",  
                headers: {  
                    "Prediction-Key": PREDICTION_KEY,  
                    "Content-Type": "application/json"  
                },  
                body: JSON.stringify({  
                    Url: img_url  
                })  
            });  
            let bodyText = JSON.parse(response["_bodyText"]);  
            let predictions = bodyText["predictions"];  
            this.setNewPrediction(predictions);  
        }