|
@@ -105,14 +105,18 @@ async def upload_images(
|
|
|
async def search_images(
|
|
|
table_name: str = None,
|
|
|
partition_names: list = [],
|
|
|
- image: UploadFile = File(...),
|
|
|
+ # image: UploadFile = File(...),
|
|
|
+ url: str = None,
|
|
|
limit: int = TOP_K
|
|
|
):
|
|
|
try:
|
|
|
- content = await image.read()
|
|
|
- img_path = os.path.join(UPLOAD_PATH, image.filename)
|
|
|
- with open(img_path, "wb+") as f:
|
|
|
- f.write(content)
|
|
|
+ # content = await image.read()
|
|
|
+ # img_path = os.path.join(UPLOAD_PATH, image.filename)
|
|
|
+ # with open(img_path, "wb+") as f:
|
|
|
+ # f.write(content)
|
|
|
+ if url is not None:
|
|
|
+ img_path = os.path.join(UPLOAD_PATH, os.path.basename(url))
|
|
|
+ urlretrieve(url, img_path)
|
|
|
res = do_search(table_name,partition_names,img_path, limit, MODEL, MILVUS_CLI)
|
|
|
list = []
|
|
|
for hits in res:
|