dindizz commited on
Commit
59dae28
1 Parent(s): 392d77e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -11
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
- # Try direct JSON export if supported
27
- try:
28
- json_output = result.document.export_to_json()
29
- except AttributeError:
30
- # Construct JSON manually if export_to_json() is not available
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