shaocongma commited on
Commit
295e94f
1 Parent(s): 8e698eb
Files changed (3) hide show
  1. app.py +4 -1
  2. auto_backgrounds.py +1 -1
  3. utils/references.py +6 -2
app.py CHANGED
@@ -12,8 +12,11 @@ from utils.file_operations import hash_name
12
  # 9. Load .bibtex file to generate a pre-defined references list. *
13
  # 1. 把paper改成纯JSON?
14
  # 2. 实现别的功能
 
 
 
 
15
  # future:
16
- # 8. Change prompts to langchain
17
  # 4. add auto_polishing function
18
  # 12. Change link to more appealing color # after the website is built;
19
  # 1. Check if there are any duplicated citations
 
12
  # 9. Load .bibtex file to generate a pre-defined references list. *
13
  # 1. 把paper改成纯JSON?
14
  # 2. 实现别的功能
15
+ # 3. Check API Key GPT-4 Support.
16
+ # 8. Re-build some components using `langchain`
17
+ # - in `references.py`, use PromptTemplates.format -> str
18
+ # - in `gpt_interation`, use LLM
19
  # future:
 
20
  # 4. add auto_polishing function
21
  # 12. Change link to more appealing color # after the website is built;
22
  # 1. Check if there are any duplicated citations
auto_backgrounds.py CHANGED
@@ -91,7 +91,7 @@ def fake_generator(title, description="", template="ICLR2022", model="gpt-4"):
91
  return make_archive("sample-output.pdf", filename)
92
 
93
 
94
- def generate_draft(title, description="", template="ICLR2022", model="gpt-4", search_engine="ss", tldr=True, max_kw_refs=14):
95
  paper, destination_folder, _ = _generation_setup(title, description, template, model, search_engine, tldr, max_kw_refs)
96
 
97
  # todo: `list_of_methods` failed to be generated; find a solution ...
 
91
  return make_archive("sample-output.pdf", filename)
92
 
93
 
94
+ def generate_draft(title, description="", template="ICLR2022", model="gpt-4", search_engine="ss", tldr=True, max_kw_refs=10):
95
  paper, destination_folder, _ = _generation_setup(title, description, template, model, search_engine, tldr, max_kw_refs)
96
 
97
  # todo: `list_of_methods` failed to be generated; find a solution ...
utils/references.py CHANGED
@@ -112,7 +112,11 @@ def _collect_papers_ss(keyword, counts=3, tldr=False):
112
  pattern = r'^\w+'
113
  words = re.findall(pattern, title)
114
  # return last_name + year_str + title.split(' ', 1)[0]
115
- return last_name + year_str + words[0]
 
 
 
 
116
 
117
  def extract_author_info(raw_authors):
118
  authors = [author['name'] for author in raw_authors]
@@ -120,7 +124,7 @@ def _collect_papers_ss(keyword, counts=3, tldr=False):
120
  authors_str = " and ".join(authors)
121
  try:
122
  last_name = authors[0].split()[-1]
123
- except:
124
  last_name = "ma"
125
  # pattern = r'^\w+'
126
  # last_name = re.findall(pattern, authors[0])
 
112
  pattern = r'^\w+'
113
  words = re.findall(pattern, title)
114
  # return last_name + year_str + title.split(' ', 1)[0]
115
+ try:
116
+ output = last_name + year_str + words[0]
117
+ except IndexError:
118
+ output = last_name + year_str + title[:4]
119
+ return output
120
 
121
  def extract_author_info(raw_authors):
122
  authors = [author['name'] for author in raw_authors]
 
124
  authors_str = " and ".join(authors)
125
  try:
126
  last_name = authors[0].split()[-1]
127
+ except IndexError:
128
  last_name = "ma"
129
  # pattern = r'^\w+'
130
  # last_name = re.findall(pattern, authors[0])