Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +25 -22
src/streamlit_app.py
CHANGED
|
@@ -3,7 +3,7 @@ import pandas as pd
|
|
| 3 |
import os
|
| 4 |
|
| 5 |
# ==============================================================================
|
| 6 |
-
# 1. STYLE CSS V2 (
|
| 7 |
# ==============================================================================
|
| 8 |
st.set_page_config(page_title="Brake Lab V2", layout="centered")
|
| 9 |
|
|
@@ -13,14 +13,15 @@ st.markdown("""
|
|
| 13 |
.stApp { background-color: #FFFFFF !important; }
|
| 14 |
* { color: #000000 !important; font-family: 'Arial', sans-serif; }
|
| 15 |
|
| 16 |
-
/* 1.2 SAISIE NUMÉRIQUE : BLANC SUR NOIR */
|
| 17 |
-
input[type="number"] {
|
| 18 |
color: #FFFFFF !important;
|
| 19 |
background-color: #1E1E1E !important;
|
| 20 |
border-radius: 8px !important;
|
| 21 |
font-weight: bold !important;
|
| 22 |
border: 2px solid #000 !important;
|
| 23 |
}
|
|
|
|
| 24 |
|
| 25 |
/* 1.3 SELECTBOX : LA BOITE PRINCIPALE (BLANC SUR NOIR) */
|
| 26 |
div[data-baseweb="select"] {
|
|
@@ -32,28 +33,32 @@ st.markdown("""
|
|
| 32 |
/* Texte sélectionné affiché dans la boite */
|
| 33 |
div[data-baseweb="select"] div {
|
| 34 |
color: #FFFFFF !important;
|
|
|
|
| 35 |
}
|
| 36 |
|
| 37 |
-
/* 1.4 LA LISTE DÉROULANTE (
|
| 38 |
div[role="listbox"], ul[role="listbox"] {
|
| 39 |
background-color: #1E1E1E !important;
|
| 40 |
}
|
| 41 |
|
| 42 |
/* Force le blanc sur tous les éléments internes de la liste */
|
| 43 |
-
li[role="option"],
|
|
|
|
|
|
|
|
|
|
| 44 |
color: #FFFFFF !important;
|
| 45 |
background-color: #1E1E1E !important;
|
| 46 |
font-weight: bold !important;
|
| 47 |
}
|
| 48 |
|
| 49 |
-
/*
|
| 50 |
li[role="option"]:hover {
|
| 51 |
background-color: #0082C3 !important;
|
| 52 |
}
|
| 53 |
|
| 54 |
-
/* 1.5 CARTES DE RÉSULTATS */
|
| 55 |
.perf-box {
|
| 56 |
-
padding:
|
| 57 |
border: 4px solid #000000;
|
| 58 |
border-radius: 15px;
|
| 59 |
background-color: #FFFFFF;
|
|
@@ -62,10 +67,10 @@ st.markdown("""
|
|
| 62 |
box-shadow: 8px 8px 0px #000;
|
| 63 |
}
|
| 64 |
.perf-value {
|
| 65 |
-
font-size:
|
| 66 |
font-weight: 900;
|
| 67 |
color: #0082C3 !important;
|
| 68 |
-
margin:
|
| 69 |
}
|
| 70 |
</style>
|
| 71 |
""", unsafe_allow_html=True)
|
|
@@ -85,14 +90,14 @@ def load_data():
|
|
| 85 |
df = load_data()
|
| 86 |
|
| 87 |
# ==============================================================================
|
| 88 |
-
# 3. INTERFACE V2 ÉPURÉE
|
| 89 |
# ==============================================================================
|
| 90 |
if not df.empty:
|
| 91 |
-
|
| 92 |
|
| 93 |
-
st.write("")
|
| 94 |
|
| 95 |
-
#
|
| 96 |
col1, col2 = st.columns(2)
|
| 97 |
|
| 98 |
with col1:
|
|
@@ -100,34 +105,32 @@ if not df.empty:
|
|
| 100 |
|
| 101 |
with col2:
|
| 102 |
model_list = df['model name'].unique().tolist()
|
| 103 |
-
model_choice = st.selectbox("
|
| 104 |
|
| 105 |
-
#
|
| 106 |
row = df[df['model name'] == model_choice].iloc[0]
|
| 107 |
res_dry = row['dry a'] * effort_val + row['dry b']
|
| 108 |
res_wet = row['wet a'] * effort_val + row['wet b']
|
| 109 |
|
| 110 |
-
# Affichage des cartes de score
|
| 111 |
st.write("")
|
| 112 |
res_c1, res_c2 = st.columns(2)
|
| 113 |
|
| 114 |
with res_c1:
|
| 115 |
st.markdown(f"""
|
| 116 |
<div class="perf-box">
|
| 117 |
-
<p style="font-size:
|
| 118 |
<p class="perf-value">{round(res_dry, 1)} N</p>
|
| 119 |
-
<p style="font-weight: bold; font-size: 16px;">Force de freinage</p>
|
| 120 |
</div>
|
| 121 |
""", unsafe_allow_html=True)
|
| 122 |
|
| 123 |
with res_c2:
|
| 124 |
st.markdown(f"""
|
| 125 |
<div class="perf-box">
|
| 126 |
-
<p style="font-size:
|
| 127 |
<p class="perf-value" style="color: #E63312 !important;">{round(res_wet, 1)} N</p>
|
| 128 |
-
<p style="font-weight: bold; font-size: 16px;">Force de freinage</p>
|
| 129 |
</div>
|
| 130 |
""", unsafe_allow_html=True)
|
| 131 |
|
| 132 |
else:
|
| 133 |
-
st.error("
|
|
|
|
| 3 |
import os
|
| 4 |
|
| 5 |
# ==============================================================================
|
| 6 |
+
# 1. STYLE CSS V2.1 (VERROUILLÉ - AUCUNE SUPPRESSION DE FONCTION)
|
| 7 |
# ==============================================================================
|
| 8 |
st.set_page_config(page_title="Brake Lab V2", layout="centered")
|
| 9 |
|
|
|
|
| 13 |
.stApp { background-color: #FFFFFF !important; }
|
| 14 |
* { color: #000000 !important; font-family: 'Arial', sans-serif; }
|
| 15 |
|
| 16 |
+
/* 1.2 SAISIE NUMÉRIQUE : TEXTE BLANC SUR FOND NOIR */
|
| 17 |
+
input[type="number"], .stNumberInput div[data-baseweb="input"] {
|
| 18 |
color: #FFFFFF !important;
|
| 19 |
background-color: #1E1E1E !important;
|
| 20 |
border-radius: 8px !important;
|
| 21 |
font-weight: bold !important;
|
| 22 |
border: 2px solid #000 !important;
|
| 23 |
}
|
| 24 |
+
input[type="number"] { color: #FFFFFF !important; }
|
| 25 |
|
| 26 |
/* 1.3 SELECTBOX : LA BOITE PRINCIPALE (BLANC SUR NOIR) */
|
| 27 |
div[data-baseweb="select"] {
|
|
|
|
| 33 |
/* Texte sélectionné affiché dans la boite */
|
| 34 |
div[data-baseweb="select"] div {
|
| 35 |
color: #FFFFFF !important;
|
| 36 |
+
font-weight: bold !important;
|
| 37 |
}
|
| 38 |
|
| 39 |
+
/* 1.4 LA LISTE DÉROULANTE (VISIBILITÉ TOTALE) */
|
| 40 |
div[role="listbox"], ul[role="listbox"] {
|
| 41 |
background-color: #1E1E1E !important;
|
| 42 |
}
|
| 43 |
|
| 44 |
/* Force le blanc sur tous les éléments internes de la liste */
|
| 45 |
+
li[role="option"],
|
| 46 |
+
li[role="option"] p,
|
| 47 |
+
li[role="option"] span,
|
| 48 |
+
li[role="option"] div {
|
| 49 |
color: #FFFFFF !important;
|
| 50 |
background-color: #1E1E1E !important;
|
| 51 |
font-weight: bold !important;
|
| 52 |
}
|
| 53 |
|
| 54 |
+
/* Couleur au survol (Bleu Decathlon) */
|
| 55 |
li[role="option"]:hover {
|
| 56 |
background-color: #0082C3 !important;
|
| 57 |
}
|
| 58 |
|
| 59 |
+
/* 1.5 CARTES DE RÉSULTATS (NOMMÉES V2.1) */
|
| 60 |
.perf-box {
|
| 61 |
+
padding: 40px;
|
| 62 |
border: 4px solid #000000;
|
| 63 |
border-radius: 15px;
|
| 64 |
background-color: #FFFFFF;
|
|
|
|
| 67 |
box-shadow: 8px 8px 0px #000;
|
| 68 |
}
|
| 69 |
.perf-value {
|
| 70 |
+
font-size: 60px; /* Légèrement plus grand car moins de texte */
|
| 71 |
font-weight: 900;
|
| 72 |
color: #0082C3 !important;
|
| 73 |
+
margin: 0px;
|
| 74 |
}
|
| 75 |
</style>
|
| 76 |
""", unsafe_allow_html=True)
|
|
|
|
| 90 |
df = load_data()
|
| 91 |
|
| 92 |
# ==============================================================================
|
| 93 |
+
# 3. INTERFACE V2.1 ÉPURÉE
|
| 94 |
# ==============================================================================
|
| 95 |
if not df.empty:
|
| 96 |
+
# --- LOGO ET TITRE SUPPRIMÉS ---
|
| 97 |
|
| 98 |
+
st.write("") # Espace de tête
|
| 99 |
|
| 100 |
+
# Zone d'entrée de données
|
| 101 |
col1, col2 = st.columns(2)
|
| 102 |
|
| 103 |
with col1:
|
|
|
|
| 105 |
|
| 106 |
with col2:
|
| 107 |
model_list = df['model name'].unique().tolist()
|
| 108 |
+
model_choice = st.selectbox("Sélectionner Modèle", options=model_list)
|
| 109 |
|
| 110 |
+
# Logique de calcul
|
| 111 |
row = df[df['model name'] == model_choice].iloc[0]
|
| 112 |
res_dry = row['dry a'] * effort_val + row['dry b']
|
| 113 |
res_wet = row['wet a'] * effort_val + row['wet b']
|
| 114 |
|
| 115 |
+
# Affichage des cartes de score épurées
|
| 116 |
st.write("")
|
| 117 |
res_c1, res_c2 = st.columns(2)
|
| 118 |
|
| 119 |
with res_c1:
|
| 120 |
st.markdown(f"""
|
| 121 |
<div class="perf-box">
|
| 122 |
+
<p style="font-size: 22px; font-weight: bold; color: #555 !important; margin-bottom: 10px;">CONDITION : SEC</p>
|
| 123 |
<p class="perf-value">{round(res_dry, 1)} N</p>
|
|
|
|
| 124 |
</div>
|
| 125 |
""", unsafe_allow_html=True)
|
| 126 |
|
| 127 |
with res_c2:
|
| 128 |
st.markdown(f"""
|
| 129 |
<div class="perf-box">
|
| 130 |
+
<p style="font-size: 22px; font-weight: bold; color: #555 !important; margin-bottom: 10px;">CONDITION : HUMIDE</p>
|
| 131 |
<p class="perf-value" style="color: #E63312 !important;">{round(res_wet, 1)} N</p>
|
|
|
|
| 132 |
</div>
|
| 133 |
""", unsafe_allow_html=True)
|
| 134 |
|
| 135 |
else:
|
| 136 |
+
st.error("Erreur : Impossible de charger le fichier 'Brake_Lab_Test_Data.xlsx'.")
|