Skip to content
Snippets Groups Projects
4-inputs.py 3.89 KiB
Newer Older
  • Learn to ignore specific revisions
  • Mouhcine's avatar
    Mouhcine committed
    from Packages import *
    
    Nicolas Barthes's avatar
    Nicolas Barthes committed
    st.set_page_config(page_title="NIRS Utils", page_icon=":goat:", layout="wide")
    
    Mouhcine's avatar
    Mouhcine committed
    from Modules import *
    from Class_Mod.DATA_HANDLING import *
    
    Nicolas Barthes's avatar
    Nicolas Barthes committed
    if 'interface' not in st.session_state:
        st.session_state['interface'] = 'simple'
    
    
    add_header()
    
    Mouhcine's avatar
    Mouhcine committed
    
    
    pages_folder = Path("pages/")
    
    
    Mouhcine's avatar
    Mouhcine committed
    
    # Initialize session state
    if 'form_submitted' not in st.session_state:
        st.session_state['form_submitted'] = False
    
    
    # Page header
    with st.container():
    
        # Text input fields
        with st.form(key='my_form'):
            st.markdown("#### Fill in your details: ####")
    
    
            col1, col3,col2 = st.columns((2,0.5,2))
    
    
            with col1:
    
                # meta_contact_name = st.text_input('First and Last name :', 'Life of Brian')
    
    Mouhcine's avatar
    Mouhcine committed
                meta_project = st.text_input('Project name :', 'Life of Brian')
                meta_sample_species = st.text_input('If relevant, sample species :', 'Life of Brian')
                meta_sample_category_options = ["Soil", "Plant", "Animal", "Other"]
                meta_sample_category = st.radio("Sample category description :", meta_sample_category_options)
                meta_sample_pretreatment_options = ["Powder", "Pastile", "Liquid"]
                meta_sample_pretreatment = st.radio("Type of sample pre-treatment :", meta_sample_pretreatment_options)
    
    
            with col2:
    
                # meta_contact_email = st.text_input('Email :', 'Example@cefe.cnrs.fr')
    
    Mouhcine's avatar
    Mouhcine committed
                meta_machine_ID = st.text_input('NIRS ID :', 'Life of Brian')
                meta_sample_sub_category_options = ["Green leave", "Leaf litter", "Litter", "Humus", "Soil", "Animal part", "Animal Powder", "Fungal sample", "Other"]
                meta_sample_sub_category = st.radio("Sample category description :", meta_sample_sub_category_options)
                meta_sample_humidity_options = ["Dry", "Fresh", "Wet"]
                meta_sample_humidity = st.radio("Humidity state of the sample:", meta_sample_humidity_options)
                meta_scan_place_options = ["Pace", "Other"]
                meta_scan_place = st.radio("If relevant, sample species :", meta_scan_place_options)
    
    
            submitted = st.form_submit_button(label='Send')
    
    
            if submitted:
                # Check if email is valid and not null
    
                # if '@' not in meta_contact_email or meta_contact_email == '':
                #     st.warning("Please enter a valid email address.")
                # else:
                # Save the form data here
                st.session_state['form_submitted'] = True
                st.success('Form sent successfully!')
    
    Mouhcine's avatar
    Mouhcine committed
    
    
        # Afficher les boutons seulement si le formulaire a été soumis
        if st.session_state['form_submitted']:
            # Buttons
            with st.container():
    
    Mouhcine's avatar
    Mouhcine committed
                if st.session_state['interface'] == 'simple':
                    header3, header4 = st.columns(2)
                    if header3.button("Samples Selection"):
    
                        st.session_state['current_page'] = pages_folder / '1-samples_selection.py'
                        st.switch_page(pages_folder / '1-samples_selection.py')
    
    Mouhcine's avatar
    Mouhcine committed
                    if header4.button("Model Creation"):
    
                        st.session_state['current_page'] = pages_folder / '2-model_creation.py'
                        st.switch_page(pages_folder / '2-model_creation.py')
    
    Mouhcine's avatar
    Mouhcine committed
                elif st.session_state['interface'] == 'advanced': 
                    header3, header4,header5 = st.columns(3)
                    if header3.button("Samples Selection"):
    
                        st.session_state['current_page'] = pages_folder / '1-samples_selection.py'
                        st.switch_page(pages_folder / '1-samples_selection.py')
    
    Mouhcine's avatar
    Mouhcine committed
                    if header4.button("Model Creation"):
    
                        st.session_state['current_page'] = pages_folder / '2-model_creation.py'
                        st.switch_page(pages_folder / '2-model_creation.py')
    
    Mouhcine's avatar
    Mouhcine committed
                    if header5.button("Prediction"):
    
                        st.session_state['current_page'] = pages_folder / '3-prediction.py'
                        st.switch_page(pages_folder / '3-prediction.py')