Update app.py
Browse files
app.py
CHANGED
|
@@ -29,16 +29,15 @@ st.divider()
|
|
| 29 |
|
| 30 |
index = pinecone.Index("scotus")
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
search = st.text_input('Search', placeholder='First Amendment cannot protect libel')
|
| 34 |
|
| 35 |
-
|
| 36 |
-
index.query(
|
| 37 |
-
vector=vector,
|
| 38 |
-
top_k=10,
|
| 39 |
-
include_values=False,
|
| 40 |
-
include_metadata=True,
|
| 41 |
-
)
|
| 42 |
|
| 43 |
|
| 44 |
|
|
|
|
| 29 |
|
| 30 |
index = pinecone.Index("scotus")
|
| 31 |
|
| 32 |
+
@st.cache_data
|
| 33 |
+
def search_index():
|
| 34 |
+
vector = model.encode([search]).tolist()
|
| 35 |
+
results = index.query(vector=vector,top_k=10,include_values=False,include_metadata=True)
|
| 36 |
+
return results
|
| 37 |
|
| 38 |
search = st.text_input('Search', placeholder='First Amendment cannot protect libel')
|
| 39 |
|
| 40 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
|
| 43 |
|