helloworld53 commited on
Commit
649c8a5
·
1 Parent(s): 1f5e68c

modifying question

Browse files
Files changed (1) hide show
  1. app.py +13 -10
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
- query = model.create_embedding(question)
67
- q = query['data'][0]['embedding']
68
- response = index.query(
69
- vector=q,
70
- top_k=1,
71
- include_metadata = True,
72
- namespace = "ns1"
73
- )
74
- response_t = response['matches'][0]['metadata']['text']
 
 
75
  st.header("Answer:")
76
- st.write(response_t)
 
 
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)