Spaces:
Running
on
Zero
Running
on
Zero
Upload app.py
Browse files
app.py
CHANGED
@@ -67,6 +67,7 @@ def add_pdf_gradio(pdf_file_list, progress=gr.Progress()):
|
|
67 |
print(pdf_file_list)
|
68 |
|
69 |
pdf_file_list = sorted(pdf_file_list, key=lambda x: os.path.basename(x))
|
|
|
70 |
knowledge_base_name = str(int(time.time()))
|
71 |
this_cache_dir = os.path.join(cache_dir, knowledge_base_name)
|
72 |
os.makedirs(this_cache_dir, exist_ok=True)
|
@@ -142,7 +143,6 @@ def retrieve_gradio(knowledge_base: str, query: str, topk: int):
|
|
142 |
query_md5 = hashlib.md5(query.encode()).hexdigest()
|
143 |
|
144 |
doc_reps_cat = torch.cat([torch.Tensor(i) for i in doc_reps], dim=0)
|
145 |
-
print(f"doc_reps_shape: {doc_reps.shape}")
|
146 |
print(f"query_rep_shape: {query_rep.shape}, doc_reps_cat_shape: {doc_reps_cat.shape}")
|
147 |
similarities = torch.matmul(query_rep, doc_reps_cat.T)
|
148 |
|
|
|
67 |
print(pdf_file_list)
|
68 |
|
69 |
pdf_file_list = sorted(pdf_file_list, key=lambda x: os.path.basename(x))
|
70 |
+
print(pdf_file_list)
|
71 |
knowledge_base_name = str(int(time.time()))
|
72 |
this_cache_dir = os.path.join(cache_dir, knowledge_base_name)
|
73 |
os.makedirs(this_cache_dir, exist_ok=True)
|
|
|
143 |
query_md5 = hashlib.md5(query.encode()).hexdigest()
|
144 |
|
145 |
doc_reps_cat = torch.cat([torch.Tensor(i) for i in doc_reps], dim=0)
|
|
|
146 |
print(f"query_rep_shape: {query_rep.shape}, doc_reps_cat_shape: {doc_reps_cat.shape}")
|
147 |
similarities = torch.matmul(query_rep, doc_reps_cat.T)
|
148 |
|