wzkariampuzha commited on
Commit
81c44d2
1 Parent(s): 66e6c20

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -3
app.py CHANGED
@@ -38,13 +38,27 @@ extract_diseases = st.sidebar.checkbox("Extract Rare Diseases", value=False)
38
 
39
  @st.cache
40
  def load_models():
41
- classify_model_vars = classify_abs.init_classify_model()
 
 
 
 
 
 
 
 
 
 
 
 
42
  NER_pipeline, entity_classes = extract_abs.init_NER_pipeline()
43
  GARD_dict, max_length = extract_abs.load_GARD_diseases()
44
- return classify_model_vars, NER_pipeline, entity_classes, GARD_dict, max_length
45
 
46
  with st.spinner('Loading Epidemiology Models and Dependencies...'):
47
- classify_model_vars, NER_pipeline, entity_classes, GARD_dict, max_length = load_models()
 
 
48
  st.success('All Models and Dependencies Loaded!')
49
 
50
  disease_or_gard_id = st.text_input("Input a rare disease term or GARD ID.")
 
38
 
39
  @st.cache
40
  def load_models():
41
+ #Load spaCy models
42
+ # nlp = spacy.load('en_core_web_lg')
43
+ nlpSci = spacy.load("en_ner_bc5cdr_md")
44
+ nlpSci2 = spacy.load('en_ner_bionlp13cg_md')
45
+
46
+ # load the tokenizer
47
+ with open('tokenizer.pickle', 'rb') as handle:
48
+ classify_tokenizer = pickle.load(handle)
49
+
50
+ # load the model
51
+ classify_model = tf.keras.models.load_model(model)
52
+
53
+ #classify_model_vars = classify_abs.init_classify_model()
54
  NER_pipeline, entity_classes = extract_abs.init_NER_pipeline()
55
  GARD_dict, max_length = extract_abs.load_GARD_diseases()
56
+ return nlpSci, nlpSci2, classify_tokenizer, classify_model, NER_pipeline, entity_classes, GARD_dict, max_length
57
 
58
  with st.spinner('Loading Epidemiology Models and Dependencies...'):
59
+ nlpSci, nlpSci2, classify_tokenizer, classify_model, NER_pipeline, entity_classes, GARD_dict, max_length = load_models()
60
+ nlp = spacy.load('en_core_web_lg')
61
+ classify_model_vars = (nlp, nlpSci, nlpSci2, classify_model, classify_tokenizer)
62
  st.success('All Models and Dependencies Loaded!')
63
 
64
  disease_or_gard_id = st.text_input("Input a rare disease term or GARD ID.")