AnanyaPathak commited on
Commit
487553a
1 Parent(s): 3a77415

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -13
app.py CHANGED
@@ -11,17 +11,19 @@ pinecone.init(
11
  index = pinecone.Index(index_id)
12
 
13
  query = st.text_iput("Query (exmaple: when to raise funds?)")
14
- model_id = "multi-qa-mpnet-base-dot-v1"
15
 
16
- model = SentenceTransformer(model_id)
17
-
18
- xq = model.encode(query).tolist()
19
-
20
- output = index.query(xq, top_k=5, include_metadata=True)
21
- for o in output["matches"]:
22
- url = o["id"].split("-")[0]
23
- start = o["metadata"]["start"]
24
- url_time = "https://youtu.be/" + url+ f"?t={start}"
25
- text = o["metadata"]["text"]
26
- st.write(url_time)
27
- st.write(text)
 
 
 
 
11
  index = pinecone.Index(index_id)
12
 
13
  query = st.text_iput("Query (exmaple: when to raise funds?)")
 
14
 
15
+ if text:
16
+ model_id = "multi-qa-mpnet-base-dot-v1"
17
+
18
+ model = SentenceTransformer(model_id)
19
+
20
+ xq = model.encode(query).tolist()
21
+
22
+ output = index.query(xq, top_k=5, include_metadata=True)
23
+ for o in output["matches"]:
24
+ url = o["id"].split("-")[0]
25
+ start = o["metadata"]["start"]
26
+ url_time = "https://youtu.be/" + url+ f"?t={start}"
27
+ text = o["metadata"]["text"]
28
+ st.write(url_time)
29
+ st.write(text)