import streamlit as st # HTML for the banner "CEFE - CNRS" bandeau_html = """ <div style="width: 100%; background-color: #4682B4; padding: 10px; margin-bottom: 10px;"> <h1 style="text-align: center; color: white;">CEFE - CNRS</h1> </div> """ # Inject the HTML code for the banner st.markdown(bandeau_html, unsafe_allow_html=True) # Initialize session state if 'form_submitted' not in st.session_state: st.session_state['form_submitted'] = False # Page header with st.container(): # Center the buttons st.markdown( """ <style> .stButton>button { display: block; margin: 0 auto; width: 200px; height: 50px; font-size: 16px; } </style> """, unsafe_allow_html=True ) # 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(): 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') # Bouton de retour à la page d'accueil st.markdown('<div style="text-align: left;"><a href="/"> <img src="house.jpg" alt="Home" style="width:50px;height:50px;"> </a></div>', unsafe_allow_html=True)