forked from talkingwallace/ChatGPT-Paper-Reader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
27 lines (23 loc) · 765 Bytes
/
example.py
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
import pickle
from gpt_reader.paper.paper import Paper
from gpt_reader.pdf_reader import PaperReader
reader = PaperReader(
openai_key='',
# proxy = {
# 'http': 'http://user:pass@host:port',
# 'https': 'http://user:pass@host:port',
# }
)
paper = Paper('./alexnet.pdf')
summary = reader.summarize(paper)
# save paper & load
pickle.dump(paper, open('digested_paper.pkl', 'wb'))
paper = pickle.load(open('digested_paper.pkl', 'rb'))
# print summary of a section
print(paper.paper_summaries[4])
print(reader.question(paper, 'Describe the proposed method in details.'))
while True:
question = input("Your question (input 'q' to quit): ")
if question.strip().lower() == 'q':
break
print(reader.question(paper, question))