-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
37 lines (27 loc) · 875 Bytes
/
main.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
28
29
30
31
32
33
34
35
36
37
"""Example code for the paper summary script"""
from src.paper_summary import (
download_paper,
get_paper_summary,
load_openai_api_key,
save_text_to_file,
)
def main():
"""Main function"""
paper_url = "shorturl.at/yBHTV"
paper_out = "./download/zhuo.pdf"
summary_out = "./output/zhuo_summary.txt"
text_out: Optional[str] = ".output/summary/text_out"
# Load the OpenAI API key
load_openai_api_key()
# Download the paper
if paper_url is not None:
download_paper(paper_url, paper_out)
# Get the summary of the paper
paper_text, paper_summary = get_paper_summary(paper_out)
# Save the summary of the paper
save_text_to_file(paper_summary, summary_out)
# Save the paper text
if text_out is not None:
save_text_to_file(paper_text, text_out)
if __name__ == "__main__":
main()