Spaces:
Sleeping
Sleeping
helloworld53
commited on
Commit
·
649c8a5
1
Parent(s):
1f5e68c
modifying question
Browse files
app.py
CHANGED
@@ -63,14 +63,17 @@ apikey = st.secrets["apikey"]
|
|
63 |
pc = Pinecone(api_key=apikey)
|
64 |
index = pc.Index("law")
|
65 |
question = st.text_input("Enter your question:")
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
|
|
75 |
st.header("Answer:")
|
76 |
-
|
|
|
|
63 |
pc = Pinecone(api_key=apikey)
|
64 |
index = pc.Index("law")
|
65 |
question = st.text_input("Enter your question:")
|
66 |
+
|
67 |
+
if question != None:
|
68 |
+
query = model.create_embedding(question)
|
69 |
+
q = query['data'][0]['embedding']
|
70 |
+
response = index.query(
|
71 |
+
vector=q,
|
72 |
+
top_k=1,
|
73 |
+
include_metadata = True,
|
74 |
+
namespace = "ns1"
|
75 |
+
)
|
76 |
+
response_t = response['matches'][0]['metadata']['text']
|
77 |
st.header("Answer:")
|
78 |
+
if response_t:
|
79 |
+
st.write(response_t)
|