logo
Browse Source

Update code

Signed-off-by: shiyu22 <shiyu.chen@zilliz.com>
main
shiyu22 2 years ago
parent
commit
a4f039ea9d
  1. 2
      README.md
  2. 2
      faiss.py

2
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(<your-vector>)

2
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

Loading…
Cancel
Save