Newer
Older
st.set_page_config(page_title="NIRS Utils", page_icon=":goat:", layout="wide",)
st.session_state["interface"] = st.session_state.get('interface')
#""" if st.session_state["interface"] == 'simple':
# hide_pages("Predictions") """
# Initialize session state
if 'form_submitted' not in st.session_state:
st.session_state['form_submitted'] = False
# 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
)
st.header("Fill in your details:",divider="blue")
st.header("Groupe 2",divider="blue")
meta_machine_ID = st.text_input('NIRS ID :', 'Life of Brian')
meta_scan_place_options = ["Pace", "Other"]
meta_scan_place = st.radio("If relevant, sample species :", meta_scan_place_options)
meta_sample_species = st.text_input('If relevant, sample species :', 'Life of Brian')
st.header("Groupe 3",divider="blue")
meta_sample_category_options = ["Soil", "Plant", "Animal", "Other"]
meta_sample_category = st.radio("Sample category description :", meta_sample_category_options)
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_sample_pretreatment_options = ["Powder", "Pastile", "Liquid"]
meta_sample_pretreatment = st.radio("Type of sample pre-treatment :", meta_sample_pretreatment_options)
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
if submitted:
# Save the form data here
st.session_state['form_submitted'] = True
st.success('Form sent successfully!')
# Création du dictionnaire avec les données du formulaire
form_data = {
"meta_project": meta_project,
"meta_sample_species": meta_sample_species,
"meta_sample_category": meta_sample_category,
"meta_sample_pretreatment": meta_sample_pretreatment,
"meta_machine_ID": meta_machine_ID,
"meta_sample_sub_category": meta_sample_sub_category,
"meta_sample_humidity": meta_sample_humidity,
"meta_scan_place": meta_scan_place
}
# Enregistrement des données dans un fichier JSON
with open('form_data.json', 'w') as json_file:
json.dump(form_data, json_file)
with st.container():
if st.session_state['interface'] == 'simple':
header3, header4 = st.columns(2)
if header3.button("Samples Selection"):
st.switch_page('pages\\1-samples_selection.py')
if header4.button("Model Creation"):
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.switch_page('pages\\1-samples_selection.py')
if header4.button("Model Creation"):
st.switch_page('pages\\2-model_creation.py')
if header5.button("Prediction"):
st.switch_page('pages\\3-prediction.py')