```py # insert imports and definitions and such fr...
# machine-learning
h
Copy code
py
# insert imports and definitions and such from above
from numpy.linalg import norm

test_embedding = classifier.encode_batch(torchaudio.load("untitled.wav")[0]).squeeze().tolist()

with TinyDB(data_path, storage = CachingMiddleware(JSONStorage)) as db:
  voices = [{**i, "distance": norm(numpy.array(i["avg_embedding"]) - numpy.array(test_embedding))} for i in db.all() if type(i["avg_embedding"]) == list]

print("\n".join([f"{i['name']} - {i['distance']}" for i in sorted(voices, key = lambda x: x["distance"])[:10]]))