Whenever var result = await endpoint.ClassifyImageAsync(myProjectID, "Iteration2", photo.GetStream());
is called an error, stating Operation returned an invalid status code 'NotFound' Xamarin forms and Azure CustomVision occurs. I have tried to follow the tutorials on Custom Visions docs and I believe myProjectID, endpoint and prediction key are correct. I am using the using the Microsoft.Azure.CognitiveServices.Vision.CustomVision.Prediction;
package for my code.
Things to note:
When I run my endpoint link in a browser it gives an error 404(has very similar error results to this error, could be correlated?)
I am storing keys and endpoint url in strings not environment variables.
namespace CustomVisionTesting
{
// Learn more about making custom code visible in the Xamarin.Forms previewer
// by visiting https://aka.ms/xamarinforms-previewer
[DesignTimeVisible(false)]
public partial class MainPage : ContentPage
{
string predictionKey = "2l013000c2355b718ng04aca6a540d5d";
string ENDPOINT = "https://realcustomvisionservice.cognitiveservices.azure.com/customvision/v3.0/Prediction/7bfir91a-m9vj-mp3k-bk34-jfkbi4jcjs24/detect/iterations/Iteration2/image";
public MainPage()
{
InitializeComponent();
}
async void Button_Clicked(System.Object sender, System.EventArgs e)
{
var options = new StoreCameraMediaOptions();
var photo = await CrossMedia.Current.TakePhotoAsync(options);
CustomVisionPredictionClient endpoint = new CustomVisionPredictionClient()
{
ApiKey = predictionKey,
Endpoint = ENDPOINT
};
Guid myProjectID = Guid.Parse("7bfir91a-m9vj-mp3k-bk34-jfkbi4jcjs24");
var result = await endpoint.ClassifyImageAsync(myProjectID, "Iteration2", photo.GetStream());
}
}