Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,10 +8,15 @@ from src.Surveyor import Surveyor
|
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
-
@st.experimental_singleton(suppress_st_warning=True)
|
| 12 |
def get_surveyor_instance(_print_fn, _survey_print_fn):
|
| 13 |
with st.spinner('Loading The-Researcher ...'):
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
def run_survey(surveyor, download_placeholder, research_keywords=None, arxiv_ids=None, max_search=None, num_papers=None):
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
|
|
|
|
| 11 |
def get_surveyor_instance(_print_fn, _survey_print_fn):
|
| 12 |
with st.spinner('Loading The-Researcher ...'):
|
| 13 |
+
with tempfile.TemporaryDirectory() as td:
|
| 14 |
+
survey_root = Path(td)
|
| 15 |
+
dir_args = {f'{dname}_dir': survey_root / dname for dname in ['pdf', 'txt', 'img', 'tab', 'dump']}
|
| 16 |
+
for d in dir_args.values():
|
| 17 |
+
d.mkdir(exist_ok=True, parents=True)
|
| 18 |
+
dir_args = {k: str(v.resolve()) for k, v in dir_args.items()}
|
| 19 |
+
return Surveyor(print_fn=_print_fn, survey_print_fn=_survey_print_fn, high_gpu=True, **dir_args)
|
| 20 |
|
| 21 |
|
| 22 |
def run_survey(surveyor, download_placeholder, research_keywords=None, arxiv_ids=None, max_search=None, num_papers=None):
|