Spaces:
Sleeping
Sleeping
DeepSoft-Tech
commited on
Commit
•
825c30f
1
Parent(s):
e5bc3ec
Update app.py
Browse files
app.py
CHANGED
@@ -52,12 +52,12 @@ with st.form("my_form"):
|
|
52 |
|
53 |
# If the user has entered a search query, search the Pinecone index with the query
|
54 |
if query:
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
52 |
|
53 |
# If the user has entered a search query, search the Pinecone index with the query
|
54 |
if query:
|
55 |
+
# Upsert the embeddings for the query into the Pinecone index
|
56 |
+
query_embeddings = model.encode(query).tolist()
|
57 |
+
# now query
|
58 |
+
xc = index.query(vector=query_embeddings, top_k=10, namespace=namespace, include_metadata=True)
|
59 |
+
|
60 |
+
# Display the search results
|
61 |
+
st.write(f"Search results for '{query}':")
|
62 |
+
for result in xc['matches']:
|
63 |
+
st.write(f"{round(result['score'], 2)}: {result['metadata']['meta_text']}")
|