sidphbot commited on
Commit
106ef8f
·
1 Parent(s): 1034007

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -6,7 +6,7 @@ from src.Surveyor import Surveyor
6
  from streamlit_tags import st_tags_sidebar
7
 
8
 
9
- @st.experimental_singleton
10
  def get_surveyor_instance(_print_fn, _survey_print_fn):
11
  with st.spinner('Loading The-Surveyor ...'):
12
  return Surveyor(print_fn=_print_fn, survey_print_fn=_survey_print_fn, high_gpu=True)
@@ -42,14 +42,13 @@ def show_survey_download(zip_file_name, survey_file_name, download_placeholder):
42
  def survey_space(surveyor, download_placeholder):
43
 
44
  form = st.sidebar.form(key='survey_form')
45
- research_keywords = form.text_input("What would you like to research in today?", key='research_keywords')
46
  max_search = form.number_input("num_papers_to_search", help="maximium number of papers to glance through - defaults to 20",
47
  min_value=1, max_value=50, value=10, step=1, key='max_search')
48
  num_papers = form.number_input("num_papers_to_select", help="maximium number of papers to select and analyse - defaults to 8",
49
  min_value=1, max_value=8, value=2, step=1, key='num_papers')
50
- submit = form.form_submit_button('Submit')
51
 
52
- st.sidebar.write('or')
53
 
54
  arxiv_ids = st_tags_sidebar(
55
  label='# Enter arxiv ids for your curated set of papers:',
@@ -57,11 +56,16 @@ def survey_space(surveyor, download_placeholder):
57
  text='Press enter to add more (e.g. 1605.08386v1, ...)',
58
  maxtags = 6,
59
  key='arxiv_ids')
60
-
 
 
 
61
  if submit:
62
- run_survey(surveyor, download_placeholder, research_keywords, max_search, num_papers)
63
- elif len(arxiv_ids):
64
- run_survey(surveyor, download_placeholder, arxiv_ids)
 
 
65
 
66
 
67
 
 
6
  from streamlit_tags import st_tags_sidebar
7
 
8
 
9
+ @st.experimental_singleton(show_spinner=True, suppress_st_warning=True)
10
  def get_surveyor_instance(_print_fn, _survey_print_fn):
11
  with st.spinner('Loading The-Surveyor ...'):
12
  return Surveyor(print_fn=_print_fn, survey_print_fn=_survey_print_fn, high_gpu=True)
 
42
  def survey_space(surveyor, download_placeholder):
43
 
44
  form = st.sidebar.form(key='survey_form')
45
+ research_keywords = form.text_input("What would you like to research in today?", key='research_keywords' value='')
46
  max_search = form.number_input("num_papers_to_search", help="maximium number of papers to glance through - defaults to 20",
47
  min_value=1, max_value=50, value=10, step=1, key='max_search')
48
  num_papers = form.number_input("num_papers_to_select", help="maximium number of papers to select and analyse - defaults to 8",
49
  min_value=1, max_value=8, value=2, step=1, key='num_papers')
 
50
 
51
+ form.write('or')
52
 
53
  arxiv_ids = st_tags_sidebar(
54
  label='# Enter arxiv ids for your curated set of papers:',
 
56
  text='Press enter to add more (e.g. 1605.08386v1, ...)',
57
  maxtags = 6,
58
  key='arxiv_ids')
59
+
60
+ submit = form.form_submit_button('Submit')
61
+
62
+ run_kwargs = {'surveyor':surveyor, 'download_placeholder':download_placeholder}
63
  if submit:
64
+ if research_keywords != '':
65
+ run_kwargs.update({'research_keywords':research_keywords, 'max_search':max_search, 'num_papers':num_papers})
66
+ elif len(arxiv_ids):
67
+ run_kwargs.update({'arxiv_ids':arxiv_ids})
68
+ run_survey(**run_kwargs)
69
 
70
 
71