Spaces:
Sleeping
Sleeping
wzkariampuzha
commited on
Commit
•
d647316
1
Parent(s):
24c9761
Update extract_abs.py
Browse files- extract_abs.py +5 -5
extract_abs.py
CHANGED
@@ -279,9 +279,9 @@ def search_term_extraction(search_term:Union[int,str], maxResults:int, filtering
|
|
279 |
|
280 |
#Returns a Pandas dataframe
|
281 |
def streamlit_extraction(search_term:Union[int,str], maxResults:int, filtering:str, #for abstract search
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
|
286 |
#Format of Output
|
287 |
ordered_labels = order_labels(entity_classes)
|
@@ -301,7 +301,7 @@ def streamlit_extraction(search_term:Union[int,str], maxResults:int, filtering:s
|
|
301 |
|
302 |
#Gather title+abstracts into a dictionary {pmid:abstract}
|
303 |
pmid_abs = classify_abs.search_getAbs(search_term_list, maxResults, filtering)
|
304 |
-
st.write("
|
305 |
|
306 |
i = 0
|
307 |
my_bar = st.progress(i)
|
@@ -352,7 +352,7 @@ def API_extraction(search_term:Union[int,str], maxResults:int, filtering:str, #f
|
|
352 |
model_outputs = [NER_pipeline(sent) for sent in sentences]
|
353 |
extraction = parse_info(sentences, model_outputs, entity_classes, extract_diseases, GARD_dict, max_length)
|
354 |
if extraction:
|
355 |
-
extraction.update({'PMID':pmid, 'ABSTRACT':abstract, 'EPI_PROB':epi_prob
|
356 |
extraction = OrderedDict([(term, extraction[term]) for term in json_output])
|
357 |
results['entries'].append(extraction)
|
358 |
|
|
|
279 |
|
280 |
#Returns a Pandas dataframe
|
281 |
def streamlit_extraction(search_term:Union[int,str], maxResults:int, filtering:str, #for abstract search
|
282 |
+
NER_pipeline:Any, entity_classes:Union[Set[str],List[str]], #for biobert extraction
|
283 |
+
extract_diseases:bool, GARD_dict:Dict[str,str], max_length:int, #for disease extraction
|
284 |
+
classify_model_vars:Tuple[Any,Any,Any,Any,Any]) -> Any: #for classification
|
285 |
|
286 |
#Format of Output
|
287 |
ordered_labels = order_labels(entity_classes)
|
|
|
301 |
|
302 |
#Gather title+abstracts into a dictionary {pmid:abstract}
|
303 |
pmid_abs = classify_abs.search_getAbs(search_term_list, maxResults, filtering)
|
304 |
+
st.write("Gathered " +str(len(pmid_abs))+" PubMed IDs. Classifying and extracting epidemiology information...")
|
305 |
|
306 |
i = 0
|
307 |
my_bar = st.progress(i)
|
|
|
352 |
model_outputs = [NER_pipeline(sent) for sent in sentences]
|
353 |
extraction = parse_info(sentences, model_outputs, entity_classes, extract_diseases, GARD_dict, max_length)
|
354 |
if extraction:
|
355 |
+
extraction.update({'PMID':pmid, 'ABSTRACT':abstract, 'EPI_PROB':epi_prob})
|
356 |
extraction = OrderedDict([(term, extraction[term]) for term in json_output])
|
357 |
results['entries'].append(extraction)
|
358 |
|