robinroy03 commited on
Commit
cdb02ce
·
1 Parent(s): 3c9b7fa

modified to make knn flexible

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -15,15 +15,18 @@ app = Flask(__name__)
15
  def query():
16
  """
17
  {
18
- embeddings: <embeddings_list>
 
19
  }
20
  """
21
 
22
- embeddings = request.get_json()['embeddings']
 
 
23
 
24
  matches = index.query(
25
  vector = embeddings,
26
- top_k = 3,
27
  include_metadata = True
28
  )
29
 
 
15
  def query():
16
  """
17
  {
18
+ embeddings: <embeddings_list>,
19
+ knn: 3
20
  }
21
  """
22
 
23
+ data = request.get_json()
24
+ embeddings = data['embeddings']
25
+ top_k = data['knn']
26
 
27
  matches = index.query(
28
  vector = embeddings,
29
+ top_k = top_k,
30
  include_metadata = True
31
  )
32