Ejemplo n.º 1
0
        public void PredictImageUrl()
        {
            string testImageUrl = "https://raw.githubusercontent.com/Microsoft/Cognitive-CustomVision-Windows/master/Samples/Images/Test/test_image.jpg";

            using (MockContext context = MockContext.Start(this.GetType().Name))
            {
                HttpMockServer.Initialize(this.GetType().Name, "PredictImageUrl", RecorderMode);

                ICustomVisionPredictionClient client = GetPredictionClientClient();
                ImageUrl url = new ImageUrl(testImageUrl);

                ImagePrediction results = client.PredictImageUrlAsync(ProjectId, url).Result;
                ValidateResults(results);
            }
        }
 public static async Task <ImagePrediction> PredictImageUrlWithRetryAsync(this ICustomVisionPredictionClient predictionApi, Guid projectId, ImageUrl imageUrl, Guid iterationId)
 {
     return(await RunTaskWithAutoRetryOnQuotaLimitExceededError <ImagePrediction>(async() => await predictionApi.PredictImageUrlAsync(projectId, imageUrl, iterationId)));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Predict an image url 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='imageUrl'>
 /// An {Iris.Web.Api.Models.ImageUrl} that contains the url of the image to be
 /// evaluated
 /// </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 PredictImageUrl(this ICustomVisionPredictionClient operations, System.Guid projectId, ImageUrl imageUrl, System.Guid?iterationId = default(System.Guid?), string application = default(string))
 {
     return(operations.PredictImageUrlAsync(projectId, imageUrl, iterationId, application).GetAwaiter().GetResult());
 }