-
Notifications
You must be signed in to change notification settings - Fork 262
Expand file tree
/
Copy pathtest.py
More file actions
32 lines (26 loc) · 713 Bytes
/
test.py
File metadata and controls
32 lines (26 loc) · 713 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
import dotenv
dotenv.load_dotenv()
api_key = os.getenv('api_key')
base_url = os.getenv('base_url')
pdf_path = '../examples/attention_is_all_you_need.pdf'
output_dir = '../examples/attention_is_all_you_need/'
pdf_path = '../examples/rh.pdf'
output_dir = '../examples/rh/'
# 清空output_dir
# import shutil
# shutil.rmtree(output_dir, ignore_errors=True)
def test_parse_pdf():
from gptpdf import parse_pdf
content, image_paths = parse_pdf(
pdf_path,
output_dir=output_dir,
api_key=api_key,
base_url=base_url,
model='gpt-4o',
gpt_worker=6
)
print(content)
print(image_paths)
if __name__ == '__main__':
test_parse_pdf()