WaterKnight commited on
Commit
3318dec
1 Parent(s): 2e697e2

Randomness removed.

Browse files
Files changed (1) hide show
  1. app.py +1 -2
app.py CHANGED
@@ -53,8 +53,7 @@ def image_from_text(text_input):
53
  similarities = list((text_features @ photo_features.T).squeeze(0))
54
 
55
  ## Return best image :)
56
- idx = sorted(zip(similarities, range(photo_features.shape[0])), key=lambda x: x[0], reverse=True)
57
- idx = idx[random.randint(0,4)][1]
58
  photo_id = photo_ids[idx]
59
  photo_data = photos[photos["photo_id"] == photo_id].iloc[0]
60
 
 
53
  similarities = list((text_features @ photo_features.T).squeeze(0))
54
 
55
  ## Return best image :)
56
+ idx = sorted(zip(similarities, range(photo_features.shape[0])), key=lambda x: x[0], reverse=True)[0][1]
 
57
  photo_id = photo_ids[idx]
58
  photo_data = photos[photos["photo_id"] == photo_id].iloc[0]
59