Upload 2 files
Browse files- app.py +45 -0
- requirements.txt +1 -0
app.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
# Style CSS pour définir le fond vert
|
| 4 |
+
st.markdown("""
|
| 5 |
+
<style>
|
| 6 |
+
body {
|
| 7 |
+
background-color: green;
|
| 8 |
+
}
|
| 9 |
+
.stButton > button {
|
| 10 |
+
background-color: #4CAF50; /* Vert bouton */
|
| 11 |
+
color: white;
|
| 12 |
+
font-size: 16px;
|
| 13 |
+
border-radius: 10px;
|
| 14 |
+
}
|
| 15 |
+
</style>
|
| 16 |
+
""", unsafe_allow_html=True)
|
| 17 |
+
|
| 18 |
+
# Titre de l'application
|
| 19 |
+
st.title("Calculateur d'IMC")
|
| 20 |
+
|
| 21 |
+
# Saisie des données utilisateur
|
| 22 |
+
poids = st.number_input("Entrez votre poids (kg):", min_value=1.0, format="%.2f")
|
| 23 |
+
poids2 = st.number_input("Entrez votre poids a la dernière consultation(kg):", min_value=1.0, format="%.2f")
|
| 24 |
+
AG1=st.number_input("Entrez Age première consultation:", min_value=1.0, format="%.2f")
|
| 25 |
+
AG2=st.number_input("Entrez Age seconde consultation:", min_value=1.0, format="%.2f")
|
| 26 |
+
taille = st.number_input("Entrez votre taille (m):", min_value=0.5, format="%.2f")
|
| 27 |
+
|
| 28 |
+
# Calcul de l'IMC avec bouton
|
| 29 |
+
if st.button("Calculer l'IMC"):
|
| 30 |
+
if taille > 0:
|
| 31 |
+
imc = poids / (taille ** 2)
|
| 32 |
+
var=(poids-poids2)/(AG2-AG1)
|
| 33 |
+
st.success(f"Votre IMC est de : {imc:.2f}")
|
| 34 |
+
st.success(f"Votre VAR est de : {var:.2f}")
|
| 35 |
+
# Interprétation de l'IMC
|
| 36 |
+
if imc < 18.5:
|
| 37 |
+
st.info("Vous êtes en insuffisance pondérale.")
|
| 38 |
+
elif 18.5 <= imc < 24.9:
|
| 39 |
+
st.success("Votre poids est normal.")
|
| 40 |
+
elif 25 <= imc < 29.9:
|
| 41 |
+
st.warning("Vous êtes en surpoids.")
|
| 42 |
+
else:
|
| 43 |
+
st.error("Vous êtes en obésité.")
|
| 44 |
+
else:
|
| 45 |
+
st.error("Veuillez entrer une taille valide.")
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
streamlit==1.37.1
|