Skip to content
Snippets Groups Projects
4-inputs.py 3.81 KiB
Newer Older
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


# 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')
            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')
            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!')


    # 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\\1-samples_selection.py'
                    st.switch_page('pages\\1-samples_selection.py')
                if header4.button("Model Creation"):
                    st.session_state['current_page'] = 'pages\\2-model_creation.py'
                    st.switch_page('pages\\2-model_creation.py')
            elif st.session_state['interface'] == 'advanced': 
                header3, header4,header5 = st.columns(3)
                if header3.button("Samples Selection"):
                    st.session_state['current_page'] = 'pages\\1-samples_selection.py'
                    st.switch_page('pages\\1-samples_selection.py')
                if header4.button("Model Creation"):
                    st.session_state['current_page'] = 'pages\\2-model_creation.py'
                    st.switch_page('pages\\2-model_creation.py')                
                if header5.button("Prediction"):
                    st.session_state['current_page'] = 'pages\\3-prediction.py'
                    st.switch_page('pages\\3-prediction.py')