From a4f039ea9dd80d2a94b14ea5071bd74eeabbe099 Mon Sep 17 00:00:00 2001 From: shiyu22 Date: Fri, 10 Feb 2023 11:45:57 +0800 Subject: [PATCH] Update code Signed-off-by: shiyu22 --- README.md | 2 +- faiss.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b2dc103..fe6f087 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ from towhee.dc2 import pipe, ops p = pipe.input('vec') \ .flat_map('vec', 'rows', ops.ann_search.faiss(findex='index.bin')) \ - .map('rows', ('id', 'score'), lambda x: (x[0], x[1], x[2])) \ + .map('rows', ('id', 'score'), lambda x: (x[0], x[1])) \ .output('id', 'score') p() diff --git a/faiss.py b/faiss.py index d14b038..4b8e0c8 100644 --- a/faiss.py +++ b/faiss.py @@ -57,7 +57,7 @@ class Faiss(PyOperator): k = self.kv_storage.get(ids[i]) else: k = ids[i] - result.extend([k, scores[0][i]]) + result.append([k, scores[0][i]]) # result.append(Entity(**{'key': k, 'score': scores[0][i]})) return result