Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
3 |
-
from appStore.prep_data import process_giz_worldwide
|
4 |
from appStore.prep_utils import create_documents, get_client
|
5 |
from appStore.embed import hybrid_embed_chunks
|
6 |
from appStore.search import hybrid_search
|
@@ -125,12 +125,16 @@ if button:
|
|
125 |
filtered_semantic = filter_results(semantic_all, country_filter, end_year_range)
|
126 |
filtered_lexical = filter_results(lexical_all, country_filter, end_year_range)
|
127 |
|
|
|
|
|
|
|
|
|
128 |
# 3) Now we take the top 10 *after* filtering
|
129 |
# Check user preference
|
130 |
if show_exact_matches:
|
131 |
st.write(f"Showing **Top 10 Lexical Search results** for query: {var}")
|
132 |
# Show the top 10 from filtered_lexical
|
133 |
-
for res in
|
134 |
project_name = res.payload['metadata'].get('project_name', 'Project Link')
|
135 |
url = res.payload['metadata'].get('url', '#')
|
136 |
st.markdown(f"#### [{project_name}]({url})")
|
@@ -172,7 +176,7 @@ if button:
|
|
172 |
else:
|
173 |
st.write(f"Showing **Top 10 Semantic Search results** for query: {var}")
|
174 |
# Show the top 10 from filtered_semantic
|
175 |
-
for res in
|
176 |
project_name = res.payload['metadata'].get('project_name', 'Project Link')
|
177 |
url = res.payload['metadata'].get('url', '#')
|
178 |
st.markdown(f"#### [{project_name}]({url})")
|
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
3 |
+
from appStore.prep_data import process_giz_worldwide, remove_duplicates
|
4 |
from appStore.prep_utils import create_documents, get_client
|
5 |
from appStore.embed import hybrid_embed_chunks
|
6 |
from appStore.search import hybrid_search
|
|
|
125 |
filtered_semantic = filter_results(semantic_all, country_filter, end_year_range)
|
126 |
filtered_lexical = filter_results(lexical_all, country_filter, end_year_range)
|
127 |
|
128 |
+
filtered_semantic_no_dupe = remove_duplicates(filtered_semantic)
|
129 |
+
filtered_lexical_no_dupe = remove_duplicates(filtered_lexical)
|
130 |
+
|
131 |
+
|
132 |
# 3) Now we take the top 10 *after* filtering
|
133 |
# Check user preference
|
134 |
if show_exact_matches:
|
135 |
st.write(f"Showing **Top 10 Lexical Search results** for query: {var}")
|
136 |
# Show the top 10 from filtered_lexical
|
137 |
+
for res in filtered_lexical_no_dupe[:10]:
|
138 |
project_name = res.payload['metadata'].get('project_name', 'Project Link')
|
139 |
url = res.payload['metadata'].get('url', '#')
|
140 |
st.markdown(f"#### [{project_name}]({url})")
|
|
|
176 |
else:
|
177 |
st.write(f"Showing **Top 10 Semantic Search results** for query: {var}")
|
178 |
# Show the top 10 from filtered_semantic
|
179 |
+
for res in filtered_semantic_no_dupe[:10]:
|
180 |
project_name = res.payload['metadata'].get('project_name', 'Project Link')
|
181 |
url = res.payload['metadata'].get('url', '#')
|
182 |
st.markdown(f"#### [{project_name}]({url})")
|