Ejemplo n.º 1
0
        public async Task <ActionResult <List <RetriveImg> > > Search([FromForm] int Num, [FromForm] IFormFile file)
        {
            // 先保存至磁盘,再加载出来
            var filePath = Path.GetTempFileName();

            Console.WriteLine(filePath);
            using (var stream = System.IO.File.Create(filePath))
            {
                await file.CopyToAsync(stream);
            }
            _preprocessor.Clear();
            var single = _preprocessor.PreprocessSingle(filePath);

            _preprocessor.TotalList.Add(single);
            _preprocessor.AfterAdd();
            // await _operator.InsertVectors(_preprocessor.TotalList);

            var res = await _operator.Search(_preprocessor.TotalList[0], Num);

            return(res);
        }