vsrinivas commited on
Commit
14bc159
·
verified ·
1 Parent(s): 557c05e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -72,13 +72,20 @@ def process_input(query, slider_value):
72
  top_k=12,
73
  vector=hdense,
74
  sparse_vector=hsparse,
75
- filter={"productDisplayName": {"$eq": query}},
76
  include_metadata=True
77
  )
78
 
79
  imgs = [images[int(r["id"])] for r in result["matches"]]
80
  matches = [x["metadata"]['productDisplayName'] for x in result["matches"]]
81
 
 
 
 
 
 
 
 
 
82
  print(f"No. of matching images: {len(imgs)}")
83
  print(matches)
84
  return display_result(imgs, matches)
 
72
  top_k=12,
73
  vector=hdense,
74
  sparse_vector=hsparse,
 
75
  include_metadata=True
76
  )
77
 
78
  imgs = [images[int(r["id"])] for r in result["matches"]]
79
  matches = [x["metadata"]['productDisplayName'] for x in result["matches"]]
80
 
81
+ ###########
82
+ exact_match = fashion.filter(lambda x: x['productDisplayName'] == query)[0]['productDisplayName']
83
+ exact_img = fashion.filter(lambda x: x['productDisplayName'] == query)[0]['image']
84
+ if exact_match is not None:
85
+ imgs.insert(0, exact_img)
86
+ matches.insert(0, exact_match)
87
+ ##########
88
+
89
  print(f"No. of matching images: {len(imgs)}")
90
  print(matches)
91
  return display_result(imgs, matches)