Ejemplo n.º 1
0
        public async void CreateImagesFromPredictions()
        {
            using (MockContext context = MockContext.Start(this.GetType()))
            {
                HttpMockServer.Initialize(this.GetType(), "CreateImagesFromPredictions", RecorderMode);

                using (var project = CreateTrainedImageClassificationProject())
                {
                    ICustomVisionTrainingClient client = BaseTests.GetTrainingClient();

                    string imageUrl         = "https://raw.githubusercontent.com/Microsoft/Cognitive-CustomVision-Windows/master/Samples/Images/Test/test_image.jpg";
                    var    predictionResult = await client.QuickTestImageUrlAsync(project.ProjectId, new ImageUrl(imageUrl), project.IterationId);

                    var i      = new ImageIdCreateEntry[] { new ImageIdCreateEntry(predictionResult.Id) };
                    var result = await client.CreateImagesFromPredictionsAsync(project.ProjectId, new ImageIdCreateBatch(i));

                    Assert.Equal(1, result.Images.Count);
                    Assert.NotEmpty(result.Images[0].SourceUrl);
                }
            }
        }