Spaces:
Sleeping
Sleeping
Commit
•
cde5ff7
1
Parent(s):
c1347a0
Update app.py
Browse files
app.py
CHANGED
@@ -41,7 +41,7 @@ filtering = st.sidebar.radio("What type of filtering would you like?",('Strict',
|
|
41 |
|
42 |
extract_diseases = st.sidebar.checkbox("Extract Rare Diseases", value=False)
|
43 |
|
44 |
-
@st.experimental_singleton
|
45 |
def load_models_experimental():
|
46 |
classify_model_vars = classify_abs.init_classify_model()
|
47 |
NER_pipeline, entity_classes = extract_abs.init_NER_pipeline()
|
@@ -62,10 +62,6 @@ def load_models():
|
|
62 |
GARD_dict, max_length = extract_abs.load_GARD_diseases()
|
63 |
return classify_tokenizer, classify_model, NER_pipeline, entity_classes, GARD_dict, max_length
|
64 |
|
65 |
-
def convert_df(df):
|
66 |
-
# IMPORTANT: Cache the conversion to prevent computation on every rerun
|
67 |
-
return df.to_csv().encode('utf-8')
|
68 |
-
|
69 |
with st.spinner('Loading Epidemiology Models and Dependencies...'):
|
70 |
classify_model_vars, NER_pipeline, entity_classes, GARD_dict, max_length = load_models_experimental()
|
71 |
#classify_tokenizer, classify_model, NER_pipeline, entity_classes, GARD_dict, max_length = load_models()
|
@@ -88,7 +84,7 @@ if disease_or_gard_id:
|
|
88 |
csv = convert_df(df)
|
89 |
st.download_button(
|
90 |
label="Download epidemiology results for "+disease_or_gard_id+" as CSV",
|
91 |
-
data=
|
92 |
file_name=disease_or_gard_id+'.csv',
|
93 |
mime='text/csv',
|
94 |
)
|
|
|
41 |
|
42 |
extract_diseases = st.sidebar.checkbox("Extract Rare Diseases", value=False)
|
43 |
|
44 |
+
@st.experimental_singleton(show_spinner=False)
|
45 |
def load_models_experimental():
|
46 |
classify_model_vars = classify_abs.init_classify_model()
|
47 |
NER_pipeline, entity_classes = extract_abs.init_NER_pipeline()
|
|
|
62 |
GARD_dict, max_length = extract_abs.load_GARD_diseases()
|
63 |
return classify_tokenizer, classify_model, NER_pipeline, entity_classes, GARD_dict, max_length
|
64 |
|
|
|
|
|
|
|
|
|
65 |
with st.spinner('Loading Epidemiology Models and Dependencies...'):
|
66 |
classify_model_vars, NER_pipeline, entity_classes, GARD_dict, max_length = load_models_experimental()
|
67 |
#classify_tokenizer, classify_model, NER_pipeline, entity_classes, GARD_dict, max_length = load_models()
|
|
|
84 |
csv = convert_df(df)
|
85 |
st.download_button(
|
86 |
label="Download epidemiology results for "+disease_or_gard_id+" as CSV",
|
87 |
+
data=df.to_csv().encode('utf-8'),
|
88 |
file_name=disease_or_gard_id+'.csv',
|
89 |
mime='text/csv',
|
90 |
)
|