Spaces:
Sleeping
Sleeping
viboognesh
commited on
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -184,7 +184,6 @@ def retrieve_and_query(query, retriever_engine):
|
|
184 |
return response, retrieved_image_path_list
|
185 |
|
186 |
def process_pdf(pdf_file , user):
|
187 |
-
import pdb; pdb.set_trace()
|
188 |
temp_dir = tempfile.TemporaryDirectory()
|
189 |
temp_pdf_path = os.path.join(temp_dir.name, pdf_file.name)
|
190 |
with open(temp_pdf_path, "wb") as f:
|
@@ -203,7 +202,6 @@ def process_pdf(pdf_file , user):
|
|
203 |
moved_count = move_images(img_save_path, data_path)
|
204 |
remove_low_size_images(data_path)
|
205 |
remove_duplicate_images(data_path)
|
206 |
-
import pdb; pdb.set_trace()
|
207 |
retriever_engine = initialize_qdrant(temp_dir.name , os.path.splitext(pdf_file.name)[0] , curr_user)
|
208 |
|
209 |
return temp_dir, retriever_engine
|
@@ -218,11 +216,9 @@ def main():
|
|
218 |
st.session_state.vectordatabase = None
|
219 |
|
220 |
uploaded_file = st.file_uploader("Choose a PDF file", type="pdf")
|
221 |
-
# import pdb; pdb.set_trace()
|
222 |
if uploaded_file is None:
|
223 |
st.info("Please upload a PDF file.")
|
224 |
else:
|
225 |
-
# import pdb; pdb.set_trace()
|
226 |
st.info(f"Uploaded PDF: {uploaded_file.name}")
|
227 |
if st.button("Process PDF"):
|
228 |
with st.spinner("Processing PDF..."):
|
|
|
184 |
return response, retrieved_image_path_list
|
185 |
|
186 |
def process_pdf(pdf_file , user):
|
|
|
187 |
temp_dir = tempfile.TemporaryDirectory()
|
188 |
temp_pdf_path = os.path.join(temp_dir.name, pdf_file.name)
|
189 |
with open(temp_pdf_path, "wb") as f:
|
|
|
202 |
moved_count = move_images(img_save_path, data_path)
|
203 |
remove_low_size_images(data_path)
|
204 |
remove_duplicate_images(data_path)
|
|
|
205 |
retriever_engine = initialize_qdrant(temp_dir.name , os.path.splitext(pdf_file.name)[0] , curr_user)
|
206 |
|
207 |
return temp_dir, retriever_engine
|
|
|
216 |
st.session_state.vectordatabase = None
|
217 |
|
218 |
uploaded_file = st.file_uploader("Choose a PDF file", type="pdf")
|
|
|
219 |
if uploaded_file is None:
|
220 |
st.info("Please upload a PDF file.")
|
221 |
else:
|
|
|
222 |
st.info(f"Uploaded PDF: {uploaded_file.name}")
|
223 |
if st.button("Process PDF"):
|
224 |
with st.spinner("Processing PDF..."):
|