sidphbot commited on
Commit
da54572
1 Parent(s): fbd25d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -14
app.py CHANGED
@@ -10,24 +10,24 @@ from src.Surveyor import Surveyor
10
 
11
 
12
 
13
- def get_surveyor_instance(_print_fn, _survey_print_fn):
14
  with st.spinner('Loading The-Researcher ...'):
15
- with tempfile.TemporaryDirectory() as td:
16
- survey_root = Path(td)
17
- dir_args = {f'{dname}_dir': survey_root / dname for dname in ['pdf', 'txt', 'img', 'tab', 'dump']}
18
- for d in dir_args.values():
19
- d.mkdir(exist_ok=True, parents=True)
20
- dir_args = {k: str(v.resolve()) for k, v in dir_args.items()}
21
- return Surveyor(print_fn=_print_fn, survey_print_fn=_survey_print_fn, high_gpu=True, **dir_args)
22
 
23
 
24
  def run_survey(_print_fn, _survey_print_fn, download_placeholder, research_keywords=None, arxiv_ids=None, max_search=None, num_papers=None):
25
- zip_file_name, survey_file_name = get_surveyor_instance(_print_fn, _survey_print_fn).survey(research_keywords,
26
- arxiv_ids,
27
- max_search=max_search,
28
- num_papers=num_papers
29
- )
30
- show_survey_download(zip_file_name, survey_file_name, download_placeholder)
 
31
 
32
 
33
  def show_survey_download(zip_file_name, survey_file_name, download_placeholder):
 
10
 
11
 
12
 
13
+ def get_surveyor_instance(td, _print_fn, _survey_print_fn):
14
  with st.spinner('Loading The-Researcher ...'):
15
+ survey_root = Path(td)
16
+ dir_args = {f'{dname}_dir': survey_root / dname for dname in ['pdf', 'txt', 'img', 'tab', 'dump']}
17
+ for d in dir_args.values():
18
+ d.mkdir(exist_ok=True, parents=True)
19
+ dir_args = {k: str(v.resolve()) for k, v in dir_args.items()}
20
+ return Surveyor(print_fn=_print_fn, survey_print_fn=_survey_print_fn, high_gpu=True, **dir_args)
 
21
 
22
 
23
  def run_survey(_print_fn, _survey_print_fn, download_placeholder, research_keywords=None, arxiv_ids=None, max_search=None, num_papers=None):
24
+ with tempfile.TemporaryDirectory() as td:
25
+ zip_file_name, survey_file_name = get_surveyor_instance(td, _print_fn, _survey_print_fn).survey(research_keywords,
26
+ arxiv_ids,
27
+ max_search=max_search,
28
+ num_papers=num_papers
29
+ )
30
+ show_survey_download(zip_file_name, survey_file_name, download_placeholder)
31
 
32
 
33
  def show_survey_download(zip_file_name, survey_file_name, download_placeholder):