Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,14 +10,16 @@ def clean_(s):
|
|
10 |
s = s.replace("\n0: ", "=")
|
11 |
return re.split('=', s, maxsplit=1)[-1].strip()
|
12 |
|
13 |
-
def similarity_search2(vectordb, query, k
|
14 |
print(f"\nQuery Key: {query}, \nrows requested:{k}\nUnique values:{unique}")
|
15 |
if unique == "False":
|
16 |
vals = vectordb.similarity_search(query,k=k)
|
17 |
else:
|
18 |
vals = vectordb.similarity_search(query,k=1)
|
|
|
19 |
for val in vals:
|
20 |
-
|
|
|
21 |
|
22 |
with gr.Blocks() as demo:
|
23 |
gr.Markdown(
|
|
|
10 |
s = s.replace("\n0: ", "=")
|
11 |
return re.split('=', s, maxsplit=1)[-1].strip()
|
12 |
|
13 |
+
def similarity_search2(vectordb, query, k, unique):
|
14 |
print(f"\nQuery Key: {query}, \nrows requested:{k}\nUnique values:{unique}")
|
15 |
if unique == "False":
|
16 |
vals = vectordb.similarity_search(query,k=k)
|
17 |
else:
|
18 |
vals = vectordb.similarity_search(query,k=1)
|
19 |
+
temp = []
|
20 |
for val in vals:
|
21 |
+
temp.append(clean_(val.page_content))
|
22 |
+
return str(np.array(temp))[1:-1]
|
23 |
|
24 |
with gr.Blocks() as demo:
|
25 |
gr.Markdown(
|