annikwag commited on
Commit
6bbd8f6
·
verified ·
1 Parent(s): efd387c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -99,7 +99,7 @@ with col3:
99
  current_year = datetime.now().year
100
  default_start_year = current_year - 5
101
 
102
- # 3) The max_value is now the actual max end_year from your collection
103
  end_year_range = st.slider(
104
  "Project End Year",
105
  min_value=2010,
@@ -144,7 +144,7 @@ def filter_results(results, country_filter, region_filter, end_year_range):
144
  return filtered
145
 
146
  if button:
147
- # 1) Use a bigger limit so we get more than 15 results
148
  results = hybrid_search(client, var, collection_name, limit=500) # e.g., 100 or 200
149
 
150
  # results is a tuple: (semantic_results, lexical_results)
@@ -159,7 +159,7 @@ if button:
159
  r for r in lexical_all if len(r.payload["page_content"]) >= 70
160
  ]
161
 
162
- # 2) Apply a threshold to SEMANTIC results (score >= 0.3)
163
  semantic_thresholded = [r for r in semantic_all if r.score >= 0.4]
164
 
165
  # 2) Filter the entire sets
@@ -170,7 +170,7 @@ if button:
170
  filtered_lexical_no_dupe = remove_duplicates(filtered_lexical)
171
 
172
 
173
- # 3) Now we take the top 15 *after* filtering
174
  # Check user preference
175
  if show_exact_matches:
176
  # 1) Display heading
 
99
  current_year = datetime.now().year
100
  default_start_year = current_year - 5
101
 
102
+ # 3) The max_value is now the actual max end_year from collection
103
  end_year_range = st.slider(
104
  "Project End Year",
105
  min_value=2010,
 
144
  return filtered
145
 
146
  if button:
147
+ # 1) Adjust limit so we get more than 15 results
148
  results = hybrid_search(client, var, collection_name, limit=500) # e.g., 100 or 200
149
 
150
  # results is a tuple: (semantic_results, lexical_results)
 
159
  r for r in lexical_all if len(r.payload["page_content"]) >= 70
160
  ]
161
 
162
+ # 2) Apply a threshold to SEMANTIC results (score >= 0.4)
163
  semantic_thresholded = [r for r in semantic_all if r.score >= 0.4]
164
 
165
  # 2) Filter the entire sets
 
170
  filtered_lexical_no_dupe = remove_duplicates(filtered_lexical)
171
 
172
 
173
+ # 3) Retrieve top 15 *after* filtering
174
  # Check user preference
175
  if show_exact_matches:
176
  # 1) Display heading