LayBraid commited on
Commit
cd52a4f
1 Parent(s): 6623aa6

:construction: change id to index

Browse files
Files changed (1) hide show
  1. text_to_image.py +1 -1
text_to_image.py CHANGED
@@ -45,7 +45,7 @@ def get_image(text, number):
45
  vector = model.get_text_features(**inputs)
46
  vector = np.asarray(vector)
47
  ids, distances = index.knnQuery(vector, k=number)
48
- result_filenames = [filename[id] for id in ids]
49
  for rank, (result_filename, score) in enumerate(zip(result_filenames, distances)):
50
  caption = "{:s} (score: {:.3f})".format(result_filename, 1.0 - score)
51
  col1, col2, col3 = st.columns([2, 10, 10])
 
45
  vector = model.get_text_features(**inputs)
46
  vector = np.asarray(vector)
47
  ids, distances = index.knnQuery(vector, k=number)
48
+ result_filenames = [filename[index] for index in ids]
49
  for rank, (result_filename, score) in enumerate(zip(result_filenames, distances)):
50
  caption = "{:s} (score: {:.3f})".format(result_filename, 1.0 - score)
51
  col1, col2, col3 = st.columns([2, 10, 10])