Update app.py
Browse files
app.py
CHANGED
@@ -23,18 +23,12 @@ def pdf_to_json(url):
|
|
23 |
# Convert the downloaded PDF file
|
24 |
result = converter.convert(temp_pdf_path)
|
25 |
|
26 |
-
#
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
content = {
|
32 |
-
"title": result.document.title if hasattr(result.document, 'title') else "Untitled",
|
33 |
-
"sections": [section.text for section in result.document.sections]
|
34 |
-
}
|
35 |
-
json_output = json.dumps(content, indent=2)
|
36 |
|
37 |
-
return json_output
|
38 |
except Exception as e:
|
39 |
return f"Error processing PDF: {e}"
|
40 |
|
|
|
23 |
# Convert the downloaded PDF file
|
24 |
result = converter.convert(temp_pdf_path)
|
25 |
|
26 |
+
# Inspect the attributes of the document to understand its structure
|
27 |
+
document_attributes = dir(result.document)
|
28 |
+
|
29 |
+
# Return document attributes for debugging purposes
|
30 |
+
return f"Document attributes: {document_attributes}"
|
|
|
|
|
|
|
|
|
|
|
31 |
|
|
|
32 |
except Exception as e:
|
33 |
return f"Error processing PDF: {e}"
|
34 |
|