sidphbot commited on
Commit
4143c64
1 Parent(s): 3083c98

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -8
app.py CHANGED
@@ -73,12 +73,21 @@ class ArxivIDsModel(BaseModel):
73
  )
74
 
75
  if __name__ == '__main__':
 
 
 
 
 
 
 
 
76
  st.sidebar.image(Image.open('logo_landscape.png'), use_column_width = 'always')
77
  st.title('Auto-Research')
78
  st.write('#### A no-code utility to generate a detailed well-cited survey with topic clustered sections'
79
  '(draft paper format) and other interesting artifacts from a single research query or a curated set of papers(arxiv ids).')
80
  st.write('##### Data Provider: arXiv Open Archive Initiative OAI')
81
  st.write('##### GitHub: https://github.com/sidphbot/Auto-Research')
 
82
  download_placeholder = st.container()
83
 
84
  with st.sidebar.form(key="survey_keywords_form"):
@@ -91,12 +100,16 @@ if __name__ == '__main__':
91
  run_kwargs = {'surveyor':get_surveyor_instance(_print_fn=st.sidebar.write, _survey_print_fn=st.write),
92
  'download_placeholder':download_placeholder}
93
  if submit:
94
- if session_data['research_keywords'] != '':
95
- run_kwargs.update({'research_keywords':session_data['research_keywords'],
96
- 'max_search':session_data['max_search'],
97
- 'num_papers':session_data['num_papers']})
98
- elif session_data['arxiv_ids'] != '':
99
- run_kwargs.update({'arxiv_ids':[id.strip() for id in session_data['arxiv_ids'].split(',')]})
100
- print(run_kwargs)
101
- run_survey(**run_kwargs)
 
 
 
 
102
 
 
73
  )
74
 
75
  if __name__ == '__main__':
76
+ if 'session_count' not in st.session_state:
77
+ st.session_state.session_count = 0
78
+
79
+ demo_session_limit = 2
80
+
81
+ if st.session_state.session_count > demo_session_limit:
82
+ st.write(f'{st.session_state.session_count} sessions running, this is a demo and only supports {demo_session_limit} parallel sessions, \n please try in sometime')
83
+
84
  st.sidebar.image(Image.open('logo_landscape.png'), use_column_width = 'always')
85
  st.title('Auto-Research')
86
  st.write('#### A no-code utility to generate a detailed well-cited survey with topic clustered sections'
87
  '(draft paper format) and other interesting artifacts from a single research query or a curated set of papers(arxiv ids).')
88
  st.write('##### Data Provider: arXiv Open Archive Initiative OAI')
89
  st.write('##### GitHub: https://github.com/sidphbot/Auto-Research')
90
+ st.write(f'Note: this is only a demo on cpu-13GB RAM, hence it supports limited number of papers & only {demo_session_limit} parallel user sessions ({st.session_state.session_count} running currently !!)')
91
  download_placeholder = st.container()
92
 
93
  with st.sidebar.form(key="survey_keywords_form"):
 
100
  run_kwargs = {'surveyor':get_surveyor_instance(_print_fn=st.sidebar.write, _survey_print_fn=st.write),
101
  'download_placeholder':download_placeholder}
102
  if submit:
103
+ if st.session_state.session_count < demo_session_limit:
104
+ st.session_state.session_count = st.session_state.session_count + 1
105
+ if session_data['research_keywords'] != '':
106
+ run_kwargs.update({'research_keywords':session_data['research_keywords'],
107
+ 'max_search':session_data['max_search'],
108
+ 'num_papers':session_data['num_papers']})
109
+ elif session_data['arxiv_ids'] != '':
110
+ run_kwargs.update({'arxiv_ids':[id.strip() for id in session_data['arxiv_ids'].split(',')]})
111
+ print(run_kwargs)
112
+ run_survey(**run_kwargs)
113
+ else:
114
+ st.write(f'{st.session_state.session_count} sessions running, this is a demo and only supports 2 parallel sessions, \n please try in sometime')
115