sc_ma commited on
Commit
a6aecff
1 Parent(s): 080555a
Files changed (2) hide show
  1. app.py +1 -4
  2. utils/references.py +9 -4
app.py CHANGED
@@ -2,13 +2,10 @@ import gradio as gr
2
  import openai
3
  from auto_backgrounds import generate_backgrounds
4
 
5
- # todo: 1. remove repeated entry in bibfile (go to references.py)
6
- # 2. (maybe) multiple commas error (see Overleaf)
7
  # 3. create a huggingface space. test it using multiple devices!
8
  # 4. further polish auto_backgrounds.py. Make backgrounds have multiple subsection.
9
  # 5. Design a good layout of huggingface space.
10
- def generate_backgrounds(t1, t2):
11
- return "README.md"
12
 
13
  def clear_inputs(text1, text2):
14
  return ("", "")
 
2
  import openai
3
  from auto_backgrounds import generate_backgrounds
4
 
5
+ # todo:
 
6
  # 3. create a huggingface space. test it using multiple devices!
7
  # 4. further polish auto_backgrounds.py. Make backgrounds have multiple subsection.
8
  # 5. Design a good layout of huggingface space.
 
 
9
 
10
  def clear_inputs(text1, text2):
11
  return ("", "")
utils/references.py CHANGED
@@ -44,7 +44,7 @@ def _collect_papers_arxiv(keyword, counts=3):
44
  for author in authors:
45
  name = author.find(f"{namespace}name").text
46
  author_list.append(name)
47
- authors_str = " , ".join(author_list)
48
 
49
  # Extract the year
50
  published = entry.find(f"{namespace}published").text
@@ -100,8 +100,6 @@ class References:
100
  for key, counts in keywords_dict.items():
101
  self.papers = self.papers + process(key, counts)
102
 
103
- # TODO: remove repeated entries
104
- # test this
105
  seen = set()
106
  papers = []
107
  for paper in self.papers:
@@ -147,4 +145,11 @@ class References:
147
  prompts = {}
148
  for paper in self.papers:
149
  prompts[paper["paper_id"]] = paper["abstract"]
150
- return prompts
 
 
 
 
 
 
 
 
44
  for author in authors:
45
  name = author.find(f"{namespace}name").text
46
  author_list.append(name)
47
+ authors_str = " and ".join(author_list)
48
 
49
  # Extract the year
50
  published = entry.find(f"{namespace}published").text
 
100
  for key, counts in keywords_dict.items():
101
  self.papers = self.papers + process(key, counts)
102
 
 
 
103
  seen = set()
104
  papers = []
105
  for paper in self.papers:
 
145
  prompts = {}
146
  for paper in self.papers:
147
  prompts[paper["paper_id"]] = paper["abstract"]
148
+ return prompts
149
+
150
+ if __name__ == "__main__":
151
+ refs = References()
152
+ keywords_dict = {"machine learning 1": 10, "machine learning 2":10}
153
+ refs.collect_papers(keywords_dict)
154
+ for p in refs.papers:
155
+ print(p["paper_id"])