Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -59,21 +59,9 @@ def find_sentences(query):
|
|
59 |
query_embedding = model.encode(query)
|
60 |
hits = util.semantic_search(query_embedding, corpus_embeddings, top_k=5)
|
61 |
hit = hits[0][0]
|
62 |
-
|
63 |
|
64 |
corpus_id = hit['corpus_id']
|
65 |
-
|
66 |
-
# Find source document based on sentence index
|
67 |
-
count = 0
|
68 |
-
for idx, c in enumerate(sentence_count):
|
69 |
-
count+=c
|
70 |
-
if (corpus_id > count-1):
|
71 |
-
continue
|
72 |
-
else:
|
73 |
-
doc = corpus[idx]
|
74 |
-
return doc
|
75 |
-
#print(f"Document: {doc}, {count}")
|
76 |
-
break
|
77 |
return corpus[corpus_id]
|
78 |
|
79 |
|
|
|
59 |
query_embedding = model.encode(query)
|
60 |
hits = util.semantic_search(query_embedding, corpus_embeddings, top_k=5)
|
61 |
hit = hits[0][0]
|
|
|
62 |
|
63 |
corpus_id = hit['corpus_id']
|
64 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
return corpus[corpus_id]
|
66 |
|
67 |
|