Update app.py
Browse files
app.py
CHANGED
@@ -62,6 +62,10 @@ def hybrid_scale(dense, sparse, alpha):
|
|
62 |
|
63 |
|
64 |
def process_input(query, slider_value):
|
|
|
|
|
|
|
|
|
65 |
try:
|
66 |
slider_value = float(slider_value)
|
67 |
sparse = bm25.encode_queries(query)
|
@@ -79,8 +83,8 @@ def process_input(query, slider_value):
|
|
79 |
matches = [x["metadata"]['productDisplayName'] for x in result["matches"]]
|
80 |
|
81 |
###########
|
82 |
-
exact_match =
|
83 |
-
exact_img =
|
84 |
if exact_match is not None:
|
85 |
imgs.insert(0, exact_img)
|
86 |
matches.insert(0, exact_match)
|
|
|
62 |
|
63 |
|
64 |
def process_input(query, slider_value):
|
65 |
+
#####################
|
66 |
+
filtered_items = [item for item in item_list if re.search(pattern, item)]
|
67 |
+
filtered_df = fashion[fashion['productDisplayName'].isin(filtered_items)]
|
68 |
+
#####################
|
69 |
try:
|
70 |
slider_value = float(slider_value)
|
71 |
sparse = bm25.encode_queries(query)
|
|
|
83 |
matches = [x["metadata"]['productDisplayName'] for x in result["matches"]]
|
84 |
|
85 |
###########
|
86 |
+
exact_match = filtered_df.filter(lambda x: x['productDisplayName'] == query)[0]['productDisplayName']
|
87 |
+
exact_img = filtered_df.filter(lambda x: x['productDisplayName'] == query)[0]['image']
|
88 |
if exact_match is not None:
|
89 |
imgs.insert(0, exact_img)
|
90 |
matches.insert(0, exact_match)
|