wzkariampuzha commited on
Commit
eaaa784
1 Parent(s): b28ab8e

Update classify_abs.py

Browse files
Files changed (1) hide show
  1. classify_abs.py +5 -5
classify_abs.py CHANGED
@@ -308,7 +308,7 @@ def streamlit_getAbs(searchterm_list:Union[List[str],List[int],str], maxResults:
308
  break
309
  pmidlist = [pmid.text for pmid in result.iter('Id')]
310
  pmids.update(pmidlist)
311
- PMIDs_bar.progress(round(len(pmids)*percent_by_step,1))
312
 
313
  url = 'https://www.ebi.ac.uk/europepmc/webservices/rest/search?query='+query+'&resulttype=core'
314
  r = requests.get(url)
@@ -322,7 +322,7 @@ def streamlit_getAbs(searchterm_list:Union[List[str],List[int],str], maxResults:
322
  pmid = pmidlist[0]
323
  if pmid[0].isdigit():
324
  pmids.add(pmid)
325
- PMIDs_bar.progress(round(len(pmids)*percent_by_step,1))
326
  PMIDs_bar.empty()
327
 
328
  with st.success('Found '+str(len(pmids))+' PMIDs. Gathering Abstracts and Filtering...'):
@@ -340,18 +340,18 @@ def streamlit_getAbs(searchterm_list:Union[List[str],List[int],str], maxResults:
340
  for term in searchterm_list:
341
  if term.lower() in uncased_ab:
342
  pmid_abs[pmid] = abstract
343
- abstracts_bar.progress(round(len(pmid_abs)*percent_by_step,1))
344
  break
345
  elif filtering =='none':
346
  pmid_abs[pmid] = abstract
347
- abstracts_bar.progress(round(len(pmid_abs)*percent_by_step,1))
348
 
349
  #Default filtering is 'lenient'.
350
  else:
351
  #Else and if are separated for readability and to better understand logical flow.
352
  if set(filter_terms).intersection(set(word_tokenize(abstract))):
353
  pmid_abs[pmid] = abstract
354
- abstracts_bar.progress(round(len(pmid_abs)*percent_by_step,1))
355
  abstracts_bar.empty()
356
 
357
  st.success('Found '+str(len(pmids))+' PMIDs. Gathered '+str(len(pmid_abs))+' Relevant Abstracts.')
 
308
  break
309
  pmidlist = [pmid.text for pmid in result.iter('Id')]
310
  pmids.update(pmidlist)
311
+ PMIDs_bar.progress(min(round(len(pmids)*percent_by_step,1),1.0)
312
 
313
  url = 'https://www.ebi.ac.uk/europepmc/webservices/rest/search?query='+query+'&resulttype=core'
314
  r = requests.get(url)
 
322
  pmid = pmidlist[0]
323
  if pmid[0].isdigit():
324
  pmids.add(pmid)
325
+ PMIDs_bar.progress(min(round(len(pmids)*percent_by_step,1),1.0)
326
  PMIDs_bar.empty()
327
 
328
  with st.success('Found '+str(len(pmids))+' PMIDs. Gathering Abstracts and Filtering...'):
 
340
  for term in searchterm_list:
341
  if term.lower() in uncased_ab:
342
  pmid_abs[pmid] = abstract
343
+ abstracts_bar.progress(min(round(len(pmid_abs)*percent_by_step,1),1.0))
344
  break
345
  elif filtering =='none':
346
  pmid_abs[pmid] = abstract
347
+ abstracts_bar.progress(min(round(len(pmid_abs)*percent_by_step,1),1.0))
348
 
349
  #Default filtering is 'lenient'.
350
  else:
351
  #Else and if are separated for readability and to better understand logical flow.
352
  if set(filter_terms).intersection(set(word_tokenize(abstract))):
353
  pmid_abs[pmid] = abstract
354
+ abstracts_bar.progress(min(round(len(pmid_abs)*percent_by_step,1),1.0))
355
  abstracts_bar.empty()
356
 
357
  st.success('Found '+str(len(pmids))+' PMIDs. Gathered '+str(len(pmid_abs))+' Relevant Abstracts.')