m. polinsky commited on
Commit
1075df3
·
unverified ·
1 Parent(s): b257ed9

Update streamlit_app.py

Browse files
Files changed (1) hide show
  1. streamlit_app.py +7 -6
streamlit_app.py CHANGED
@@ -18,7 +18,7 @@ import random
18
  # EDIT: before doing NER check time of last scrape and just read in from JSON store instead of rescraping
19
  # can force rescrape
20
  # This may take a config to get sources as input
21
-
22
  def initialize(limit, rando, use_cache=True):
23
  clusters: dict[str:List[namedtuple]] = dict()
24
  # This is a container for the source classes.
@@ -190,9 +190,10 @@ with st.form(key='columns_in_form'):
190
  selections = [i for i in selections if i is not None]
191
  with st.spinner(text="Digesting...please wait, this will take a few moments...Maybe check some messages or start reading the latest papers on summarization with transformers...."):
192
  found = False
 
193
  # Check if we already have this digest.
194
  for i in digests:
195
- if set(list(answers.values())) == set(list(i)):
196
  digestor = digests[i]
197
  found = True
198
  break
@@ -222,11 +223,11 @@ with st.form(key='columns_in_form'):
222
 
223
  # Get displayable digest and digest data
224
  digestor.build_digest()# only returns for data collection
225
-
226
- digest = digestor.text
227
- if len(digest) == 0:
228
  st.write("You didn't select a topic!")
229
  else:
230
  st.write("Your digest is ready:\n")
231
 
232
- st.write(digest)
 
18
  # EDIT: before doing NER check time of last scrape and just read in from JSON store instead of rescraping
19
  # can force rescrape
20
  # This may take a config to get sources as input
21
+ @st.cache()
22
  def initialize(limit, rando, use_cache=True):
23
  clusters: dict[str:List[namedtuple]] = dict()
24
  # This is a container for the source classes.
 
190
  selections = [i for i in selections if i is not None]
191
  with st.spinner(text="Digesting...please wait, this will take a few moments...Maybe check some messages or start reading the latest papers on summarization with transformers...."):
192
  found = False
193
+
194
  # Check if we already have this digest.
195
  for i in digests:
196
+ if set(selections) == set(list(i)):
197
  digestor = digests[i]
198
  found = True
199
  break
 
223
 
224
  # Get displayable digest and digest data
225
  digestor.build_digest()# only returns for data collection
226
+ digests[tuple(digestor.user_choices)] = digestor
227
+
228
+ if len(digestor.text) == 0:
229
  st.write("You didn't select a topic!")
230
  else:
231
  st.write("Your digest is ready:\n")
232
 
233
+ st.write(digestor.text)