Spaces:
Build error
Build error
Update app.py
Browse files9 unmodified lines1011121314151617181920212223242526272829303132339 unmodified linesdef get_surveyor_instance(_print_fn, _survey_print_fn):with st.spinner('Loading The-Researcher ...'):with tempfile.TemporaryDirectory() as td:survey_root = Path(td)dir_args = {f'{dname}_dir': survey_root / dname for dname in ['pdf', 'txt', 'img', 'tab', 'dump']}for d in dir_args.values():d.mkdir(exist_ok=True, parents=True)dir_args = {k: str(v.resolve()) for k, v in dir_args.items()}return Surveyor(print_fn=_print_fn, survey_print_fn=_survey_print_fn, high_gpu=True, **dir_args)def run_survey(_print_fn, _survey_print_fn, download_placeholder, research_keywords=None, arxiv_ids=None, max_search=None, num_papers=None):zip_file_name, survey_file_name = get_surveyor_instance(_print_fn, _survey_print_fn).survey(research_keywords,arxiv_ids,max_search=max_search,num_papers=num_papers)show_survey_download(zip_file_name, survey_file_name, download_placeholder)def show_survey_download(zip_file_name, survey_file_name, download_placeholder):9 unmodified lines1011121314151617181920212223242526272829303132339 unmodified linesdef get_surveyor_instance(td, _print_fn, _survey_print_fn):with st.spinner('Loading The-Researcher ...'):survey_root = Path(td)dir_args = {f'{dname}_dir': survey_root / dname for dname in ['pdf', 'txt', 'img', 'tab', 'dump']}for d in dir_args.values():d.mkdir(exist_ok=True, parents=True)dir_args = {k: str(v.resolve()) for k, v in dir_args.items()}return Surveyor(print_fn=_print_fn, survey_print_fn=_survey_print_fn, high_gpu=True, **dir_args)def run_survey(_print_fn, _survey_print_fn, download_placeholder, research_keywords=None, arxiv_ids=None, max_search=None, num_papers=None):with tempfile.TemporaryDirectory() as td:zip_file_name, survey_file_name = get_surveyor_instance(td, _print_fn, _survey_print_fn).survey(research_keywords,arxiv_ids,max_search=max_search,num_papers=num_papers)show_survey_download(zip_file_name, survey_file_name, download_placeholder)def show_survey_download(zip_file_name, survey_file_name, download_placeholder):
app.py+14-14