vsrinivas commited on
Commit
cdb1c55
·
verified ·
1 Parent(s): 12b4459

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -74,7 +74,8 @@ def process_input(query, slider_value):
74
  query=query
75
  print(f"Query: {query}")
76
  search_words = query.title().split()
77
- pattern = r"(?=.*\b" + r"\b)(?=.*\b".join(map(re.escape, search_words)) + r"\b)"
 
78
  filtered_items = [item for item in item_list if re.search(pattern, item)]
79
  print(f"Filtered items: {filtered_items}")
80
  filtered_df = fashion_df[fashion_df['productDisplayName'].isin(filtered_items)]
@@ -117,7 +118,8 @@ def update_textbox(choice):
117
 
118
  def text_process(search_string):
119
  search_words = search_string.title().split()
120
- pattern = r"(?=.*\b" + r"\b)(?=.*\b".join(map(re.escape, search_words)) + r"\b)"
 
121
  filtered_items = [item for item in item_list if re.search(pattern, item)]
122
  return gr.update(visible=True), gr.update(choices=filtered_items, value=filtered_items[0] if filtered_items else "")
123
 
 
74
  query=query
75
  print(f"Query: {query}")
76
  search_words = query.title().split()
77
+ # pattern = r"(?=.*\b" + r"\b)(?=.*\b".join(map(re.escape, search_words)) + r"\b)"
78
+ pattern = r"(?=.*" + r")(?=.*".join(map(re.escape, search_words)) + r")"
79
  filtered_items = [item for item in item_list if re.search(pattern, item)]
80
  print(f"Filtered items: {filtered_items}")
81
  filtered_df = fashion_df[fashion_df['productDisplayName'].isin(filtered_items)]
 
118
 
119
  def text_process(search_string):
120
  search_words = search_string.title().split()
121
+ # pattern = r"(?=.*\b" + r"\b)(?=.*\b".join(map(re.escape, search_words)) + r"\b)"
122
+ pattern = r"(?=.*" + r")(?=.*".join(map(re.escape, search_words)) + r")"
123
  filtered_items = [item for item in item_list if re.search(pattern, item)]
124
  return gr.update(visible=True), gr.update(choices=filtered_items, value=filtered_items[0] if filtered_items else "")
125