コード例 #1
0
        private async Task <ImagePrediction> CustomVisionAnalyzeImageByUrlAsync(string imageUrl, Guid projectId, string publishedName, CustomVisionProjectType projectType)
        {
            ImagePrediction imagePrediction = null;

            switch (projectType)
            {
            case CustomVisionProjectType.Classification:
                imagePrediction = await _customVisionPredictionClient.ClassifyImageUrlWithNoStoreAsync(
                    projectId : projectId,
                    publishedName : publishedName,
                    imageUrl : new ImageUrl(imageUrl));

                break;

            case CustomVisionProjectType.Object_Detection:
                imagePrediction = await _customVisionPredictionClient.DetectImageUrlWithNoStoreAsync(
                    projectId : projectId,
                    publishedName : publishedName,
                    imageUrl : new ImageUrl(imageUrl));

                break;
            }

            return(imagePrediction);
        }