Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -172,7 +172,7 @@ if search_buttion or prev_query != str(query_input):
|
|
172 |
query_embedding = model.encode([query]).numpy()
|
173 |
|
174 |
distances = scipy.spatial.distance.cdist(
|
175 |
-
query_embedding, sentence_vectors, metric="
|
176 |
)[0]
|
177 |
|
178 |
results = zip(range(len(distances)), distances)
|
@@ -183,6 +183,6 @@ if search_buttion or prev_query != str(query_input):
|
|
183 |
page_url = df.iloc[idx]["page"]
|
184 |
for img_url in df.iloc[idx]["images"]:
|
185 |
md_content += f'<a href="{page_url}" target="_blank" rel="noopener noreferrer"><img src="{img_url}" width="100"></a>'
|
186 |
-
md_content += f'\n[%.4f {df.iloc[idx]["
|
187 |
-
md_content += f'\n{df.iloc[idx]["normalized_description"]}'
|
188 |
st.markdown(md_content, unsafe_allow_html=True)
|
|
|
172 |
query_embedding = model.encode([query]).numpy()
|
173 |
|
174 |
distances = scipy.spatial.distance.cdist(
|
175 |
+
query_embedding, sentence_vectors, metric="cosine"
|
176 |
)[0]
|
177 |
|
178 |
results = zip(range(len(distances)), distances)
|
|
|
183 |
page_url = df.iloc[idx]["page"]
|
184 |
for img_url in df.iloc[idx]["images"]:
|
185 |
md_content += f'<a href="{page_url}" target="_blank" rel="noopener noreferrer"><img src="{img_url}" width="100"></a>'
|
186 |
+
md_content += f'\n[%.4f {df.iloc[idx]["description"]}]({page_url})' % (distance / 2)
|
187 |
+
#md_content += f'\n{df.iloc[idx]["normalized_description"]}'
|
188 |
st.markdown(md_content, unsafe_allow_html=True)
|