Spaces:
Runtime error
Runtime error
AnanyaPathak
commited on
Commit
•
487553a
1
Parent(s):
3a77415
Update app.py
Browse files
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 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
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)
|