Exemple #1
0
        private async Task <bool> AI(int?id)
        {
            var thread = _service.GetById(id);

            string imageUri = thread.Image;

            // Create a client
            ComputerVisionClient client = Authenticate(endpoint, subscriptionKey);

            var r = await _visionService.AnalyzeImageUrl(client, imageUri);

            return(_visionService.Description(r));
        }
        //[HttpGet("{id}")]
        public async Task <IActionResult> AI(int?id)
        {
            var thread = _threadService.GetById(id);

            if (thread == null)
            {
                return(BadRequest());
            }
            string imageUri = thread.Image;

            // Create a client
            ComputerVisionClient client = Authenticate(endpoint, subscriptionKey);

            var r = await _service.AnalyzeImageUrl(client, imageUri);

            _service.Faces(r);
            _service.Objects(r);
            _service.Tags(r);

            var boolHuman = _service.Description(r);

            //return RedirectToAction("Index", "Thread", new { @id = thread.ID });
            return(Json(boolHuman));
        }