Spaces:
Build error
Build error
Update app.py
Browse filesadded debug statements to store_document_data and extract_data_from_pdf
app.py
CHANGED
|
@@ -34,6 +34,7 @@ def store_document_data(PDF_FILE, METADATA_FILE, INDEX_FILE):
|
|
| 34 |
|
| 35 |
if PDF_FILE:
|
| 36 |
# Extract text from the PDF
|
|
|
|
| 37 |
text = extract_text_from_pdf(PDF_FILE)
|
| 38 |
if not text:
|
| 39 |
return "Could not extract any text from the PDF."
|
|
@@ -108,7 +109,7 @@ def extract_text_from_pdf(pdf_file):
|
|
| 108 |
store_document(text)
|
| 109 |
return text
|
| 110 |
except Exception as e:
|
| 111 |
-
print(f"Error extracting text: {e}")
|
| 112 |
return None
|
| 113 |
|
| 114 |
def split_text(text, chunk_size=500):
|
|
@@ -178,4 +179,4 @@ iface = gr.TabbedInterface(
|
|
| 178 |
)
|
| 179 |
|
| 180 |
# Launch Gradio app
|
| 181 |
-
iface.launch()
|
|
|
|
| 34 |
|
| 35 |
if PDF_FILE:
|
| 36 |
# Extract text from the PDF
|
| 37 |
+
print(PDF_FILE)
|
| 38 |
text = extract_text_from_pdf(PDF_FILE)
|
| 39 |
if not text:
|
| 40 |
return "Could not extract any text from the PDF."
|
|
|
|
| 109 |
store_document(text)
|
| 110 |
return text
|
| 111 |
except Exception as e:
|
| 112 |
+
print(f"Error extracting text: {e}{pdf_file}")
|
| 113 |
return None
|
| 114 |
|
| 115 |
def split_text(text, chunk_size=500):
|
|
|
|
| 179 |
)
|
| 180 |
|
| 181 |
# Launch Gradio app
|
| 182 |
+
iface.launch(show_error=True)
|