importappimportutilsfromutilsimportregression,models,custom_regression,plots# Not the best way to import, but it's convenient. Please make this nicerimportgcimportglobimportstreamlitasstdefmain():st.set_page_config(layout="wide",page_title=app.TITLE,)st.markdown(f""" <style>{utils.get_styles()} </style> """,unsafe_allow_html=True)gc.set_threshold(0)# disable garbage collectionapp.main()gc.collect()if__name__=="__main__":main()
importstreamlitasstimportutilsdefinput_filters(df,menu_selected_external,menu_options_external,menu_selected_internal,menu_options_internal):withst.sidebar:# st.divider()st.subheader("Data Input Filters")filter_cols=["Study_Identifier","Temperature"]# , "Sample_Identifier"filters_selected={}n_cols=3cols=st.columns([2,1])current_col=0forcolinfilter_cols:comparison_page==(menu_selected_external==menu_options_external[3]andmenu_selected_internal==menu_options_external[2])withcols[current_col]:if((col==filter_cols[0]andnotcomparison_page)or(col==filter_cols[1]andcomparison_page)):single_only=Trueelse:single_only=Falsefilters_selected.update({col:generate_filter(df,col,single_only)})current_col=(current_col+1)%n_colskeys=list(filters_selected.keys())values=list(filters_selected.values())returnkeys,valuesdefgenerate_filter(df,col,single_only=False):""" returns list for modularity and ease """options=generate_options(df,col)ifsingle_only:selected=[st.selectbox(label=col.split("_")[0],options=options)]else:selected=st.multiselect(label=col.split("_")[0],options=options)iflen(selected)==0:selected=optionsreturnselected
Last Updated: 2024-05-14 ; Contributors: AhmedThahir