示例#1
0
        public List <TransferFile> Post([FromBody] string dir)
        {
            List <TransferFile> pred = new List <TransferFile>();
            Recognition         R    = new Recognition();

            R.Run(dir);
            using var LibContext = new LibraryContext();
            foreach (var path in Directory.GetFiles(dir).Where(s => s.EndsWith(".png") || s.EndsWith(".jpg") || s.EndsWith(".bmp") || s.EndsWith(".gif")))
            {
                var byteImg = from item in LibContext.ImageObjs
                              where item.Path == path
                              select item.ImageDetails.Image;
                var tempImg            = Convert.ToBase64String(byteImg.First());
                Tuple <int, float> res = LibContext.FindResults(path);
                pred.Add(new TransferFile()
                {
                    Path = path, Label = res.Item1, Confidence = res.Item2, Image = tempImg
                });
            }

            return(pred);
        }