Spaces:
Runtime error
Runtime error
elia-waefler
commited on
Commit
·
fce75da
1
Parent(s):
457ed1c
reverse
Browse files- app.py +2 -2
- my_2_sim_search.py +2 -2
app.py
CHANGED
@@ -148,7 +148,6 @@ def main():
|
|
148 |
else:
|
149 |
st.warning("unsaved embeddings will be lost.")
|
150 |
else:
|
151 |
-
|
152 |
vec_store = setup_db.load_vectorstore_from_excel("data/KBOB_Klassifizierung.xlsx")
|
153 |
sst.page = "home"
|
154 |
file = st.file_uploader("upload file", accept_multiple_files=False)
|
@@ -185,7 +184,8 @@ def main():
|
|
185 |
sorted_vec_table = my_2_sim_search.sim_search_fly(vec_table=vec_store, term=full_search)
|
186 |
st.success("sim search")
|
187 |
st.write(f"len of list of categories {len(list(sorted_vec_table.keys()))}")
|
188 |
-
|
|
|
189 |
st.write(category)
|
190 |
for category in list(sorted_vec_table.keys())[-3:]:
|
191 |
st.write(category)
|
|
|
148 |
else:
|
149 |
st.warning("unsaved embeddings will be lost.")
|
150 |
else:
|
|
|
151 |
vec_store = setup_db.load_vectorstore_from_excel("data/KBOB_Klassifizierung.xlsx")
|
152 |
sst.page = "home"
|
153 |
file = st.file_uploader("upload file", accept_multiple_files=False)
|
|
|
184 |
sorted_vec_table = my_2_sim_search.sim_search_fly(vec_table=vec_store, term=full_search)
|
185 |
st.success("sim search")
|
186 |
st.write(f"len of list of categories {len(list(sorted_vec_table.keys()))}")
|
187 |
+
st.write(f"the most fitting category is {sorted_vec_table.keys()}")
|
188 |
+
for category in list(sorted_vec_table.keys())[0]:
|
189 |
st.write(category)
|
190 |
for category in list(sorted_vec_table.keys())[-3:]:
|
191 |
st.write(category)
|
my_2_sim_search.py
CHANGED
@@ -38,7 +38,7 @@ def sim_search_load_db(database, term, add_to_db=True, debug=False):
|
|
38 |
sim_search_dict[key] = dp * distance
|
39 |
|
40 |
# sort with the biggest similarity
|
41 |
-
sorted_table = dict(sorted(sim_search_dict.items(), key=lambda item: item[1]
|
42 |
|
43 |
if debug:
|
44 |
for key, value in sorted_table[:5]:
|
@@ -152,7 +152,7 @@ def sim_search_fly(vec_table, term, debug=False):
|
|
152 |
sim_search_dict[key] = dp #* distance
|
153 |
|
154 |
# sort with the biggest similarity
|
155 |
-
sorted_table = dict(sorted(sim_search_dict.items(), key=lambda item: item[1]
|
156 |
|
157 |
if debug:
|
158 |
for key, value in sorted_table[:5]:
|
|
|
38 |
sim_search_dict[key] = dp * distance
|
39 |
|
40 |
# sort with the biggest similarity
|
41 |
+
sorted_table = dict(sorted(sim_search_dict.items(), key=lambda item: item[1], reverse=True))
|
42 |
|
43 |
if debug:
|
44 |
for key, value in sorted_table[:5]:
|
|
|
152 |
sim_search_dict[key] = dp #* distance
|
153 |
|
154 |
# sort with the biggest similarity
|
155 |
+
sorted_table = dict(sorted(sim_search_dict.items(), key=lambda item: item[1], reverse=True))
|
156 |
|
157 |
if debug:
|
158 |
for key, value in sorted_table[:5]:
|