Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -102,7 +102,7 @@ with col3:
|
|
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=
|
106 |
max_value=max_end_year,
|
107 |
value=(default_start_year, max_end_year),
|
108 |
)
|
@@ -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
|
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)
|
@@ -170,11 +170,11 @@ if button:
|
|
170 |
filtered_lexical_no_dupe = remove_duplicates(filtered_lexical)
|
171 |
|
172 |
|
173 |
-
# 3) Now we take the top
|
174 |
# Check user preference
|
175 |
if show_exact_matches:
|
176 |
# 1) Display heading
|
177 |
-
st.write(f"Showing **Top
|
178 |
|
179 |
# 2) Do a simple substring check (case-insensitive)
|
180 |
# We'll create a new list lexical_substring_filtered
|
@@ -199,8 +199,8 @@ if button:
|
|
199 |
if not filtered_lexical_no_dupe:
|
200 |
st.write('No exact matches, consider unchecking "Show only exact matches"')
|
201 |
else:
|
202 |
-
# 6) Display the first
|
203 |
-
for res in filtered_lexical_no_dupe[:
|
204 |
project_name = res.payload['metadata'].get('project_name', 'Project Link')
|
205 |
url = res.payload['metadata'].get('url', '#')
|
206 |
st.markdown(f"#### [{project_name}]({url})")
|
@@ -264,13 +264,13 @@ if button:
|
|
264 |
st.divider()
|
265 |
|
266 |
else:
|
267 |
-
st.write(f"Showing **Top
|
268 |
|
269 |
if not filtered_semantic_no_dupe:
|
270 |
st.write("No relevant results found.")
|
271 |
else:
|
272 |
-
# Show the top
|
273 |
-
for res in filtered_semantic_no_dupe[:
|
274 |
project_name = res.payload['metadata'].get('project_name', 'Project Link')
|
275 |
url = res.payload['metadata'].get('url', '#')
|
276 |
st.markdown(f"#### [{project_name}]({url})")
|
|
|
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,
|
106 |
max_value=max_end_year,
|
107 |
value=(default_start_year, max_end_year),
|
108 |
)
|
|
|
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)
|
|
|
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
|
177 |
+
st.write(f"Showing **Top 15 Lexical Search results** for query: {var}")
|
178 |
|
179 |
# 2) Do a simple substring check (case-insensitive)
|
180 |
# We'll create a new list lexical_substring_filtered
|
|
|
199 |
if not filtered_lexical_no_dupe:
|
200 |
st.write('No exact matches, consider unchecking "Show only exact matches"')
|
201 |
else:
|
202 |
+
# 6) Display the first 15 matching results
|
203 |
+
for res in filtered_lexical_no_dupe[:15]:
|
204 |
project_name = res.payload['metadata'].get('project_name', 'Project Link')
|
205 |
url = res.payload['metadata'].get('url', '#')
|
206 |
st.markdown(f"#### [{project_name}]({url})")
|
|
|
264 |
st.divider()
|
265 |
|
266 |
else:
|
267 |
+
st.write(f"Showing **Top 15 Semantic Search results** for query: {var}")
|
268 |
|
269 |
if not filtered_semantic_no_dupe:
|
270 |
st.write("No relevant results found.")
|
271 |
else:
|
272 |
+
# Show the top 15 from filtered_semantic
|
273 |
+
for res in filtered_semantic_no_dupe[:15]:
|
274 |
project_name = res.payload['metadata'].get('project_name', 'Project Link')
|
275 |
url = res.payload['metadata'].get('url', '#')
|
276 |
st.markdown(f"#### [{project_name}]({url})")
|