code: def main(argv):
      del argv
  
      with open(os.path.realpath(FLAGS.embedding_file), "rb") as emb_f:
          embedding = np.load(emb_f)
      with open(os.path.realpath(FLAGS.embedding_file), "rb") as id_f:
          idx = np.load(id_f)
  
      assert len(idx) == len(embedding)
  
      index = build_index(embedding)
  
      if FLAGS.query_file:
          query = parse_query()
      else:
          query = embedding[:25]
  
      D, I = index.search(query, 10)
      I = np.array([[idx[col] for col in row] for row in I])
  
      result = {"distance": D, "idx": I}
      with open("result.pkl", "wb") as f:
          pickle.dump(result, f)
  
file_path: euler/knn/knn.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import pickle
  import faiss
  import numpy
  from absl import app
  from absl import flags
label_desc: Use image node_id 3 for calling a global function with example usage: main(argv) without return types