Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
colpali fix
Browse files
pages/Multimodal_Conversational_Search.py
CHANGED
|
@@ -347,29 +347,29 @@ with st.sidebar:
|
|
| 347 |
|
| 348 |
|
| 349 |
# st.subheader(":blue[Your multi-modal documents]")
|
| 350 |
-
|
| 351 |
-
|
| 352 |
|
| 353 |
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
|
| 374 |
############## haystach demo temporary addition ############
|
| 375 |
#if(pdf_doc_ is None or pdf_doc_ == ""):
|
|
|
|
| 347 |
|
| 348 |
|
| 349 |
# st.subheader(":blue[Your multi-modal documents]")
|
| 350 |
+
pdf_doc_ = st.file_uploader(
|
| 351 |
+
"Upload your PDFs here and click on 'Process'", accept_multiple_files=False)
|
| 352 |
|
| 353 |
|
| 354 |
+
pdf_docs = [pdf_doc_]
|
| 355 |
+
if st.button("Process"):
|
| 356 |
+
with st.spinner("Processing"):
|
| 357 |
+
if os.path.isdir(parent_dirname+"/pdfs") == False:
|
| 358 |
+
os.mkdir(parent_dirname+"/pdfs")
|
| 359 |
|
| 360 |
+
for pdf_doc in pdf_docs:
|
| 361 |
+
print(type(pdf_doc))
|
| 362 |
+
pdf_doc_name = (pdf_doc.name).replace(" ","_")
|
| 363 |
+
with open(os.path.join(parent_dirname+"/pdfs",pdf_doc_name),"wb") as f:
|
| 364 |
+
f.write(pdf_doc.getbuffer())
|
| 365 |
|
| 366 |
+
request_ = { "bucket": s3_bucket_,"key": pdf_doc_name}
|
| 367 |
+
# if(st.session_state.input_copali_rerank):
|
| 368 |
+
# copali.process_doc(request_)
|
| 369 |
+
# else:
|
| 370 |
+
rag_DocumentLoader.load_docs(request_)
|
| 371 |
+
print('lambda done')
|
| 372 |
+
st.success('you can start searching on your PDF')
|
| 373 |
|
| 374 |
############## haystach demo temporary addition ############
|
| 375 |
#if(pdf_doc_ is None or pdf_doc_ == ""):
|