Spaces:
Sleeping
Sleeping
fix requirements and minor fixes
Browse files- app.py +3 -0
- requirements.txt +2 -1
app.py
CHANGED
@@ -31,6 +31,8 @@ def process_pdfs(parent_dir: Union[str,list]):
|
|
31 |
if type(parent_dir) == str :
|
32 |
parent_dir = [parent_dir]
|
33 |
for file_path in parent_dir:
|
|
|
|
|
34 |
# creating a pdf file object
|
35 |
pdfFileObj = open(file_path, 'rb')
|
36 |
|
@@ -91,6 +93,7 @@ def predict(query,file_paths, k=3):
|
|
91 |
|
92 |
with gr.Blocks() as demo :
|
93 |
with gr.Column():
|
|
|
94 |
files = gr.Files(label="Upload PDFs",type="filepath",file_count="multiple")
|
95 |
query = gr.Text(label="query")
|
96 |
with gr.Accordion():
|
|
|
31 |
if type(parent_dir) == str :
|
32 |
parent_dir = [parent_dir]
|
33 |
for file_path in parent_dir:
|
34 |
+
if ".pdf" not in file_path : # skip non pdf files
|
35 |
+
continue
|
36 |
# creating a pdf file object
|
37 |
pdfFileObj = open(file_path, 'rb')
|
38 |
|
|
|
93 |
|
94 |
with gr.Blocks() as demo :
|
95 |
with gr.Column():
|
96 |
+
gr.Markdown("## PDF Search Engine")
|
97 |
files = gr.Files(label="Upload PDFs",type="filepath",file_count="multiple")
|
98 |
query = gr.Text(label="query")
|
99 |
with gr.Accordion():
|
requirements.txt
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
datasets
|
2 |
PyPDF2
|
3 |
-
torch
|
|
|
|
1 |
datasets
|
2 |
PyPDF2
|
3 |
+
torch
|
4 |
+
transformers
|