Add some Python code to test bindings

This commit is contained in:
Dirkjan Ochtman 2021-03-17 17:18:24 +01:00
parent 09b526717e
commit b3500d4a34
1 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,14 @@
import instant_distance, random
def main():
points = [[random.random() for _ in range(300)] for _ in range(1024)]
config = instant_distance.Config()
(hnsw, ids) = instant_distance.Hnsw.build(points, config)
p = [random.random() for _ in range(300)]
search = instant_distance.Search()
hnsw.search(p, search)
for pid in search:
print(pid)
if __name__ == '__main__':
main()