wzkariampuzha commited on
Commit
388fbdd
·
1 Parent(s): bc29af4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -9
app.py CHANGED
@@ -13,17 +13,16 @@ st.title("Epidemiology Extraction Pipeline for Rare Diseases")
13
  st.subheader("National Center for Advancing Translational Sciences (NIH/NCATS)")
14
 
15
 
16
-
17
  #### CHANGE SIDEBAR WIDTH ###
18
  st.markdown(
19
  """
20
  <style>
21
  [data-testid="stSidebar"][aria-expanded="true"] > div:first-child {
22
- width: 300px;
23
  }
24
  [data-testid="stSidebar"][aria-expanded="false"] > div:first-child {
25
- width: 300px;
26
- margin-left: -500px;
27
  }
28
  </style>
29
  """,
@@ -37,11 +36,17 @@ filtering = st.sidebar.radio("What type of filtering would you like?",('Strict',
37
 
38
  extract_diseases = st.sidebar.checkbox("Extract Rare Diseases", value=False)
39
 
40
- with st.spinner('Loading Epidemiology Models and Dependencies...'):
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
- st.success('All Models and Dependencies Loaded!')
 
 
 
 
 
 
45
 
46
  disease_or_gard_id = st.text_input("Input a rare disease term or GARD ID.", value="Fellman syndrome")
47
 
 
13
  st.subheader("National Center for Advancing Translational Sciences (NIH/NCATS)")
14
 
15
 
 
16
  #### CHANGE SIDEBAR WIDTH ###
17
  st.markdown(
18
  """
19
  <style>
20
  [data-testid="stSidebar"][aria-expanded="true"] > div:first-child {
21
+ width: 275px;
22
  }
23
  [data-testid="stSidebar"][aria-expanded="false"] > div:first-child {
24
+ width: 275px;
25
+ margin-left: -400px;
26
  }
27
  </style>
28
  """,
 
36
 
37
  extract_diseases = st.sidebar.checkbox("Extract Rare Diseases", value=False)
38
 
39
+ @st.cache(suppress_st_warning=True)
40
+ def load_models():
41
+ global classify_model_vars, NER_pipeline, entity_classes, GARD_dict, max_length
42
+
43
+ with st.spinner('Loading Epidemiology Models and Dependencies...'):
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
+ st.success('All Models and Dependencies Loaded!')
48
+
49
+ load_models()
50
 
51
  disease_or_gard_id = st.text_input("Input a rare disease term or GARD ID.", value="Fellman syndrome")
52