Spaces:
Sleeping
Sleeping
wzkariampuzha
commited on
Commit
•
091df08
1
Parent(s):
7780086
Update app.py
Browse files
app.py
CHANGED
@@ -63,10 +63,10 @@ def load_models():
|
|
63 |
return classify_tokenizer, classify_model, NER_pipeline, entity_classes, GARD_dict, max_length
|
64 |
|
65 |
@st.cache
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
#@st.experimental_memo
|
71 |
@st.cache(allow_output_mutation=True)
|
72 |
def epi_sankey(sankey_data):
|
@@ -111,9 +111,10 @@ if disease_or_gard_id:
|
|
111 |
extract_diseases,GARD_dict, max_length,
|
112 |
classify_model_vars)
|
113 |
st.dataframe(df, height=100)
|
|
|
114 |
st.download_button(
|
115 |
label="Download epidemiology results for "+disease_or_gard_id+" as CSV",
|
116 |
-
data=
|
117 |
file_name=disease_or_gard_id+'.csv',
|
118 |
mime='text/csv',
|
119 |
)
|
|
|
63 |
return classify_tokenizer, classify_model, NER_pipeline, entity_classes, GARD_dict, max_length
|
64 |
|
65 |
@st.cache
|
66 |
+
def convert_df(df):
|
67 |
+
# IMPORTANT: Cache the conversion to prevent computation on every rerun
|
68 |
+
return df.to_csv().encode('utf-8')
|
69 |
+
|
70 |
#@st.experimental_memo
|
71 |
@st.cache(allow_output_mutation=True)
|
72 |
def epi_sankey(sankey_data):
|
|
|
111 |
extract_diseases,GARD_dict, max_length,
|
112 |
classify_model_vars)
|
113 |
st.dataframe(df, height=100)
|
114 |
+
csv = convert_df(df)
|
115 |
st.download_button(
|
116 |
label="Download epidemiology results for "+disease_or_gard_id+" as CSV",
|
117 |
+
data = csv,
|
118 |
file_name=disease_or_gard_id+'.csv',
|
119 |
mime='text/csv',
|
120 |
)
|