tcy6 commited on
Commit
b65fc25
1 Parent(s): 5823b5b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -88,7 +88,7 @@ def add_pdf_gradio(pdf_file_binary, progress=gr.Progress()):
88
  image_md5 = get_image_md5(image)
89
  image_md5s.append(image_md5)
90
  with torch.no_grad():
91
- reps = encode([image]).squeeze(0)
92
  reps_list.append(reps)
93
  images.append(image)
94
 
@@ -122,7 +122,7 @@ def retrieve_gradio(knowledge_base: str, query: str, topk: int):
122
  for line in f:
123
  md5s.append(line.rstrip('\n'))
124
 
125
- doc_reps = np.load(os.path.join(target_cache_dir, f"reps.npy")).squeeze(1)
126
 
127
  query_with_instruction = "Represent this query for retrieving relavant document: " + query
128
  with torch.no_grad():
 
88
  image_md5 = get_image_md5(image)
89
  image_md5s.append(image_md5)
90
  with torch.no_grad():
91
+ reps = encode([image])
92
  reps_list.append(reps)
93
  images.append(image)
94
 
 
122
  for line in f:
123
  md5s.append(line.rstrip('\n'))
124
 
125
+ doc_reps = np.load(os.path.join(target_cache_dir, f"reps.npy"))
126
 
127
  query_with_instruction = "Represent this query for retrieving relavant document: " + query
128
  with torch.no_grad():