sidphbot commited on
Commit
1f3126c
1 Parent(s): fefaa55

download fix

Browse files
Files changed (1) hide show
  1. app.py +13 -47
app.py CHANGED
@@ -23,21 +23,19 @@ def run_survey(surveyor, download_placeholder, research_keywords=None, arxiv_ids
23
 
24
 
25
  def show_survey_download(zip_file_name, survey_file_name, download_placeholder):
26
- download_placeholder.empty()
27
- with download_placeholder.container():
28
- with open(str(zip_file_name), "rb") as file:
29
- btn = st.download_button(
30
- label="Download extracted topic-clustered-highlights, images and tables as zip",
31
- data=file,
32
- file_name=str(zip_file_name)
33
- )
34
-
35
- with open(str(survey_file_name), "rb") as file:
36
- btn = st.download_button(
37
- label="Download detailed generated survey file",
38
- data=file,
39
- file_name=str(survey_file_name)
40
- )
41
 
42
 
43
  class KeywordsModel(BaseModel):
@@ -77,37 +75,6 @@ def survey_space(surveyor, download_placeholder):
77
  run_kwargs.update({'arxiv_ids':[id.strip() for id in session_data['arxiv_ids'].split(',')]})
78
  st.json(run_kwargs)
79
  run_survey(**run_kwargs)
80
-
81
- '''
82
- form = st.sidebar.form(key='survey_form')
83
- research_keywords = form.text_input("Enter your research keywords:", key='research_keywords', value='')
84
- max_search = form.number_input("num_papers_to_search", help="maximium number of papers to glance through - defaults to 20",
85
- min_value=1, max_value=50, value=10, step=1, key='max_search')
86
- num_papers = form.number_input("num_papers_to_select", help="maximium number of papers to select and analyse - defaults to 8",
87
- min_value=1, max_value=8, value=2, step=1, key='num_papers')
88
-
89
- form.write('or')
90
-
91
- arxiv_ids = st_sidebar_tags(
92
- label='Enter arxiv ids for your curated set of papers (1-by-1):',
93
- value=[],
94
- text='Press enter to add more (e.g. 2205.12755, 2205.10937, 1605.08386v1 ...)',
95
- maxtags = 6,
96
- key='arxiv_ids')
97
-
98
- submit = form.form_submit_button('Submit')
99
-
100
-
101
- run_kwargs = {'surveyor':surveyor, 'download_placeholder':download_placeholder}
102
- if submit:
103
- if research_keywords != '':
104
- run_kwargs.update({'research_keywords':research_keywords, 'max_search':max_search, 'num_papers':num_papers})
105
- elif len(arxiv_ids):
106
- run_kwargs.update({'arxiv_ids':arxiv_ids})
107
- run_survey(**run_kwargs)
108
- '''
109
-
110
-
111
 
112
 
113
  if __name__ == '__main__':
@@ -116,6 +83,5 @@ if __name__ == '__main__':
116
  std_col.header('execution log:')
117
  survey_col.header('Generated_survey:')
118
  download_placeholder = survey_col.container()
119
- download_placeholder = st.empty()
120
  surveyor_obj = get_surveyor_instance(_print_fn=std_col.write, _survey_print_fn=survey_col.write)
121
  survey_space(surveyor_obj, survey_col)
 
23
 
24
 
25
  def show_survey_download(zip_file_name, survey_file_name, download_placeholder):
26
+ with open(str(zip_file_name), "rb") as file:
27
+ btn = download_placeholder.download_button(
28
+ label="Download extracted topic-clustered-highlights, images and tables as zip",
29
+ data=file,
30
+ file_name=str(zip_file_name)
31
+ )
32
+
33
+ with open(str(survey_file_name), "rb") as file:
34
+ btn = download_placeholder.download_button(
35
+ label="Download detailed generated survey file",
36
+ data=file,
37
+ file_name=str(survey_file_name)
38
+ )
 
 
39
 
40
 
41
  class KeywordsModel(BaseModel):
 
75
  run_kwargs.update({'arxiv_ids':[id.strip() for id in session_data['arxiv_ids'].split(',')]})
76
  st.json(run_kwargs)
77
  run_survey(**run_kwargs)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
 
80
  if __name__ == '__main__':
 
83
  std_col.header('execution log:')
84
  survey_col.header('Generated_survey:')
85
  download_placeholder = survey_col.container()
 
86
  surveyor_obj = get_surveyor_instance(_print_fn=std_col.write, _survey_print_fn=survey_col.write)
87
  survey_space(surveyor_obj, survey_col)