Ejemplo n.º 1
0
        public Task <string> AnalizeImage(IFormFile file)
        {
            if (file == null)
            {
                throw new InvalidDataException("Необходимо загрузить изображение");
            }

            using var stream = file.OpenReadStream();
            var result = _classify.Classify(stream);

            return(Task.FromResult(result));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Extracts the triples which comprise the class hierarchy
        /// </summary>
        /// <returns></returns>
        public IEnumerable <Triple> Classify()
        {
            Type svcType = typeof(ClassifyService);

            if (_kb.SupportsService(svcType))
            {
                ClassifyService svc = (ClassifyService)_kb.GetService(svcType);
                return(svc.Classify().Triples);
            }
            else
            {
                throw new NotSupportedException("The Knowledge Base does not support the Classify service");
            }
        }