mirror of
https://github.com/VectifyAI/PageIndex.git
synced 2026-04-24 23:56:21 +02:00
add output path print
This commit is contained in:
parent
12400d7635
commit
288a4376a1
1 changed files with 13 additions and 5 deletions
|
|
@ -69,10 +69,14 @@ if __name__ == "__main__":
|
|||
|
||||
# Save results
|
||||
pdf_name = os.path.splitext(os.path.basename(args.pdf_path))[0]
|
||||
os.makedirs('./results', exist_ok=True)
|
||||
output_dir = './results'
|
||||
output_file = f'{output_dir}/{pdf_name}_structure.json'
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
with open(f'./results/{pdf_name}_structure.json', 'w', encoding='utf-8') as f:
|
||||
with open(output_file, 'w', encoding='utf-8') as f:
|
||||
json.dump(toc_with_page_number, f, indent=2)
|
||||
|
||||
print(f'Tree structure saved to: {output_file}')
|
||||
|
||||
elif args.md_path:
|
||||
# Validate Markdown file
|
||||
|
|
@ -119,7 +123,11 @@ if __name__ == "__main__":
|
|||
|
||||
# Save results
|
||||
md_name = os.path.splitext(os.path.basename(args.md_path))[0]
|
||||
os.makedirs('./results', exist_ok=True)
|
||||
output_dir = './results'
|
||||
output_file = f'{output_dir}/{md_name}_structure.json'
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
with open(f'./results/{md_name}_structure.json', 'w', encoding='utf-8') as f:
|
||||
json.dump(toc_with_page_number, f, indent=2, ensure_ascii=False)
|
||||
with open(output_file, 'w', encoding='utf-8') as f:
|
||||
json.dump(toc_with_page_number, f, indent=2, ensure_ascii=False)
|
||||
|
||||
print(f'Tree structure saved to: {output_file}')
|
||||
Loading…
Add table
Add a link
Reference in a new issue