private async Task <ImagePrediction> CustomVisionAnalyzeImageByStreamAsync(Stream imageStream, Guid projectId, string publishedName, CustomVisionProjectType projectType) { ImagePrediction imagePrediction = null; switch (projectType) { case CustomVisionProjectType.Classification: imagePrediction = await _customVisionPredictionClient.ClassifyImageWithNoStoreAsync( projectId : projectId, publishedName : publishedName, imageData : imageStream); break; case CustomVisionProjectType.Object_Detection: imagePrediction = await _customVisionPredictionClient.DetectImageWithNoStoreAsync( projectId : projectId, publishedName : publishedName, imageData : imageStream); break; } return(imagePrediction); }