Spaces:
Sleeping
Sleeping
wzkariampuzha
commited on
Commit
•
b102419
1
Parent(s):
2360c00
Update app.py
Browse files
app.py
CHANGED
@@ -39,6 +39,13 @@ filtering = st.sidebar.radio("What type of filtering would you like?",('Strict',
|
|
39 |
|
40 |
extract_diseases = st.sidebar.checkbox("Extract Rare Diseases", value=False)
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
@st.cache(allow_output_mutation=True)
|
43 |
def load_models():
|
44 |
# load the tokenizer
|
@@ -54,12 +61,14 @@ def load_models():
|
|
54 |
return classify_tokenizer, classify_model, NER_pipeline, entity_classes, GARD_dict, max_length
|
55 |
|
56 |
with st.spinner('Loading Epidemiology Models and Dependencies...'):
|
57 |
-
|
|
|
|
|
58 |
#Load spaCy models which cannot be cached due to hash function error
|
59 |
-
nlp = spacy.load('en_core_web_lg')
|
60 |
-
nlpSci = spacy.load("en_ner_bc5cdr_md")
|
61 |
-
nlpSci2 = spacy.load('en_ner_bionlp13cg_md')
|
62 |
-
classify_model_vars = (nlp, nlpSci, nlpSci2, classify_model, classify_tokenizer)
|
63 |
st.success('All Models and Dependencies Loaded!')
|
64 |
|
65 |
disease_or_gard_id = st.text_input("Input a rare disease term or GARD ID.")
|
|
|
39 |
|
40 |
extract_diseases = st.sidebar.checkbox("Extract Rare Diseases", value=False)
|
41 |
|
42 |
+
@st.experimental_singleton
|
43 |
+
def load_models_experimental():
|
44 |
+
classify_model_vars = classify_abs.init_classify_model()
|
45 |
+
NER_pipeline, entity_classes = extract_abs.init_NER_pipeline()
|
46 |
+
GARD_dict, max_length = extract_abs.load_GARD_diseases()
|
47 |
+
return classify_model_vars, NER_pipeline, entity_classes, GARD_dict, max_length
|
48 |
+
|
49 |
@st.cache(allow_output_mutation=True)
|
50 |
def load_models():
|
51 |
# load the tokenizer
|
|
|
61 |
return classify_tokenizer, classify_model, NER_pipeline, entity_classes, GARD_dict, max_length
|
62 |
|
63 |
with st.spinner('Loading Epidemiology Models and Dependencies...'):
|
64 |
+
classify_model_vars, NER_pipeline, entity_classes, GARD_dict, max_length = load_models_experimental()
|
65 |
+
|
66 |
+
#classify_tokenizer, classify_model, NER_pipeline, entity_classes, GARD_dict, max_length = load_models()
|
67 |
#Load spaCy models which cannot be cached due to hash function error
|
68 |
+
#nlp = spacy.load('en_core_web_lg')
|
69 |
+
#nlpSci = spacy.load("en_ner_bc5cdr_md")
|
70 |
+
#nlpSci2 = spacy.load('en_ner_bionlp13cg_md')
|
71 |
+
#classify_model_vars = (nlp, nlpSci, nlpSci2, classify_model, classify_tokenizer)
|
72 |
st.success('All Models and Dependencies Loaded!')
|
73 |
|
74 |
disease_or_gard_id = st.text_input("Input a rare disease term or GARD ID.")
|