Example #1
0
        public void TestCustomVision()
        {
            var newGuid = Guid.NewGuid();

            var image = new Image
            {
                Created     = DateTime.Now,
                Description = "Test description",
                id          = newGuid,
                Name        = "Test name",
                // use our fluffy test image
                Bytes = File.ReadAllBytes("Images/dog-medium-landing-hero.jpg")
            };

            CustomerVisionHelper.RunCustomVisionService(image);
        }
Example #2
0
        public static void Run(
            [ServiceBusTrigger("images", AccessRights.Manage, Connection = "ServiceBusConnection")]
            string imageId, TraceWriter log)
        {
            log.Info($"New image detected from the queue: {imageId}");

            var image = DocumentDbHelper
                        .GetImageAsync($"{imageId}").Result;

            // if we can't find it in the database, do nothing
            if (image == null)
            {
                log.Info($"This image wasn't found in the database.");
                return;
            }

            VisionApiHelper
            .AdornImageWithVisionMetadataAsync(
                image
                );

            CustomerVisionHelper
            .RunCustomVisionService(image);

            // insert azureML code here

            //ThumbnailHelper
            //    .ApplyThumbnail(image);

            DocumentDbHelper
            .UpdateImage(image);

            if (image.Tags == null)
            {
                return;
            }

            log.Info($"Adorned image tags to it from cognitive services ({string.Join(",", image.Tags)})");
            log.Info($"And this description: ({image.PredictedCaption})");
        }