whoami02 commited on
Commit
261e71b
1 Parent(s): 4f94a4a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
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=1, unique="True"):
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
- return clean_(val.page_content)
 
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(