Пример #1
0
        public void PredictImage()
        {
            using (MockContext context = MockContext.Start(this.GetType().Name))
            {
                HttpMockServer.Initialize(this.GetType().Name, "PredictImage", RecorderMode);

                ICustomVisionPredictionClient client = GetPredictionClientClient();
                using (FileStream stream = new FileStream(Path.Combine("TestImages", "test_image.jpg"), FileMode.Open))
                {
                    ImagePrediction results = client.PredictImageAsync(ProjectId, stream).Result;
                    ValidateResults(results);
                }
            }
        }
 public static async Task <ImagePrediction> PredictImageWithRetryAsync(this ICustomVisionPredictionClient predictionApi, Guid projectId, Func <Task <Stream> > imageStreamCallback, Guid iterationId)
 {
     return(await RunTaskWithAutoRetryOnQuotaLimitExceededError <ImagePrediction>(async() => await predictionApi.PredictImageAsync(projectId, await imageStreamCallback(), iterationId)));
 }
Пример #3
0
 /// <summary>
 /// Predict an image and saves the result
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='projectId'>
 /// The project id
 /// </param>
 /// <param name='imageData'>
 /// </param>
 /// <param name='iterationId'>
 /// Optional. Specifies the id of a particular iteration to evaluate against.
 /// The default iteration for the project will be used when not specified
 /// </param>
 /// <param name='application'>
 /// Optional. Specifies the name of application using the endpoint
 /// </param>
 public static ImagePrediction PredictImage(this ICustomVisionPredictionClient operations, System.Guid projectId, Stream imageData, System.Guid?iterationId = default(System.Guid?), string application = default(string))
 {
     return(operations.PredictImageAsync(projectId, imageData, iterationId, application).GetAwaiter().GetResult());
 }