Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +30 -59
src/streamlit_app.py
CHANGED
|
@@ -3,79 +3,69 @@ 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 |
|
| 10 |
st.markdown("""
|
| 11 |
<style>
|
| 12 |
-
/* 1.1 FOND GLOBAL
|
| 13 |
.stApp { background-color: #FFFFFF !important; }
|
| 14 |
* { color: #000000 !important; font-family: 'Arial', sans-serif; }
|
| 15 |
|
| 16 |
-
/* 1.2
|
| 17 |
input[type="number"] {
|
| 18 |
color: #FFFFFF !important;
|
| 19 |
background-color: #1E1E1E !important;
|
| 20 |
border-radius: 8px !important;
|
| 21 |
font-weight: bold !important;
|
|
|
|
| 22 |
}
|
| 23 |
|
| 24 |
-
/* 1.3 SELECTBOX : LA BOITE PRINCIPALE */
|
| 25 |
div[data-baseweb="select"] {
|
| 26 |
background-color: #1E1E1E !important;
|
| 27 |
border: 2px solid #000000 !important;
|
| 28 |
border-radius: 8px !important;
|
| 29 |
}
|
|
|
|
|
|
|
| 30 |
div[data-baseweb="select"] div {
|
| 31 |
-
color: #FFFFFF !important;
|
| 32 |
}
|
| 33 |
|
| 34 |
-
/* 1.4 LA LISTE DÉROULANTE (
|
| 35 |
-
div[role="listbox"] {
|
| 36 |
background-color: #1E1E1E !important;
|
| 37 |
}
|
| 38 |
|
| 39 |
-
|
|
|
|
| 40 |
color: #FFFFFF !important;
|
| 41 |
background-color: #1E1E1E !important;
|
| 42 |
font-weight: bold !important;
|
| 43 |
-
padding: 10px !important;
|
| 44 |
-
border-bottom: 1px solid #333333 !important;
|
| 45 |
}
|
| 46 |
|
| 47 |
-
|
|
|
|
| 48 |
background-color: #0082C3 !important;
|
| 49 |
-
color: #FFFFFF !important;
|
| 50 |
-
}
|
| 51 |
-
|
| 52 |
-
li[role="option"] span {
|
| 53 |
-
color: #FFFFFF !important;
|
| 54 |
}
|
| 55 |
|
| 56 |
/* 1.5 CARTES DE RÉSULTATS */
|
| 57 |
.perf-box {
|
| 58 |
-
padding:
|
| 59 |
-
border:
|
| 60 |
border-radius: 15px;
|
| 61 |
background-color: #FFFFFF;
|
| 62 |
text-align: center;
|
| 63 |
margin-top: 20px;
|
| 64 |
-
box-shadow:
|
| 65 |
}
|
| 66 |
.perf-value {
|
| 67 |
-
font-size:
|
| 68 |
font-weight: 900;
|
| 69 |
color: #0082C3 !important;
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
/* 1.6 SECTION COEFFICIENTS */
|
| 73 |
-
.coef-info {
|
| 74 |
-
margin-top: 30px;
|
| 75 |
-
padding: 15px;
|
| 76 |
-
background-color: #F0F2F6;
|
| 77 |
-
border-radius: 10px;
|
| 78 |
-
border: 1px solid #CCC;
|
| 79 |
}
|
| 80 |
</style>
|
| 81 |
""", unsafe_allow_html=True)
|
|
@@ -95,14 +85,14 @@ def load_data():
|
|
| 95 |
df = load_data()
|
| 96 |
|
| 97 |
# ==============================================================================
|
| 98 |
-
# 3. INTERFACE V2
|
| 99 |
# ==============================================================================
|
| 100 |
if not df.empty:
|
| 101 |
st.markdown("<h1 style='text-align: center;'>🎯 Brake Performance Finder</h1>", unsafe_allow_html=True)
|
| 102 |
-
st.markdown("<p style='text-align: center; color: #666 !important;'>Entrée Effort -> Extraction Coefficients -> Résultat</p>", unsafe_allow_html=True)
|
| 103 |
|
| 104 |
st.write("")
|
| 105 |
|
|
|
|
| 106 |
col1, col2 = st.columns(2)
|
| 107 |
|
| 108 |
with col1:
|
|
@@ -112,51 +102,32 @@ if not df.empty:
|
|
| 112 |
model_list = df['model name'].unique().tolist()
|
| 113 |
model_choice = st.selectbox("Modèle (Model)", options=model_list)
|
| 114 |
|
| 115 |
-
#
|
| 116 |
row = df[df['model name'] == model_choice].iloc[0]
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
a_dry, b_dry = row['dry a'], row['dry b']
|
| 120 |
-
res_dry = a_dry * effort_val + b_dry
|
| 121 |
-
|
| 122 |
-
# Paramètres Humide
|
| 123 |
-
a_wet, b_wet = row['wet a'], row['wet b']
|
| 124 |
-
res_wet = a_wet * effort_val + b_wet
|
| 125 |
|
| 126 |
-
#
|
| 127 |
st.write("")
|
| 128 |
res_c1, res_c2 = st.columns(2)
|
| 129 |
|
| 130 |
with res_c1:
|
| 131 |
st.markdown(f"""
|
| 132 |
<div class="perf-box">
|
| 133 |
-
<p style="font-size:
|
| 134 |
<p class="perf-value">{round(res_dry, 1)} N</p>
|
| 135 |
-
<p style="font-weight: bold;">Force de freinage</p>
|
| 136 |
</div>
|
| 137 |
""", unsafe_allow_html=True)
|
| 138 |
|
| 139 |
with res_c2:
|
| 140 |
st.markdown(f"""
|
| 141 |
<div class="perf-box">
|
| 142 |
-
<p style="font-size:
|
| 143 |
<p class="perf-value" style="color: #E63312 !important;">{round(res_wet, 1)} N</p>
|
| 144 |
-
<p style="font-weight: bold;">Force de freinage</p>
|
| 145 |
</div>
|
| 146 |
""", unsafe_allow_html=True)
|
| 147 |
|
| 148 |
-
# --- SECTION DÉTAILS (AUTOMATIQUE) ---
|
| 149 |
-
st.markdown("---")
|
| 150 |
-
with st.expander("🛠️ Détails des Coefficients (Extraits de Data)"):
|
| 151 |
-
c_sec, c_hum = st.columns(2)
|
| 152 |
-
with c_sec:
|
| 153 |
-
st.write(f"**Coefficients Sec :**")
|
| 154 |
-
st.write(f"a = `{a_dry}`")
|
| 155 |
-
st.write(f"b = `{b_dry}`")
|
| 156 |
-
with c_hum:
|
| 157 |
-
st.write(f"**Coefficients Humide :**")
|
| 158 |
-
st.write(f"a = `{a_wet}`")
|
| 159 |
-
st.write(f"b = `{b_wet}`")
|
| 160 |
-
|
| 161 |
else:
|
| 162 |
-
st.error("
|
|
|
|
| 3 |
import os
|
| 4 |
|
| 5 |
# ==============================================================================
|
| 6 |
+
# 1. STYLE CSS V2 (LISIBILITÉ TOTALE - ÉPURÉ)
|
| 7 |
# ==============================================================================
|
| 8 |
st.set_page_config(page_title="Brake Lab V2", layout="centered")
|
| 9 |
|
| 10 |
st.markdown("""
|
| 11 |
<style>
|
| 12 |
+
/* 1.1 FOND GLOBAL BLANC */
|
| 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"] {
|
| 27 |
background-color: #1E1E1E !important;
|
| 28 |
border: 2px solid #000000 !important;
|
| 29 |
border-radius: 8px !important;
|
| 30 |
}
|
| 31 |
+
|
| 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 (FIX FINAL LISIBILITÉ) */
|
| 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"], li[role="option"] p, li[role="option"] span, li[role="option"] div {
|
| 44 |
color: #FFFFFF !important;
|
| 45 |
background-color: #1E1E1E !important;
|
| 46 |
font-weight: bold !important;
|
|
|
|
|
|
|
| 47 |
}
|
| 48 |
|
| 49 |
+
/* Survol (Bleu Decathlon) */
|
| 50 |
+
li[role="option"]:hover {
|
| 51 |
background-color: #0082C3 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
}
|
| 53 |
|
| 54 |
/* 1.5 CARTES DE RÉSULTATS */
|
| 55 |
.perf-box {
|
| 56 |
+
padding: 35px;
|
| 57 |
+
border: 4px solid #000000;
|
| 58 |
border-radius: 15px;
|
| 59 |
background-color: #FFFFFF;
|
| 60 |
text-align: center;
|
| 61 |
margin-top: 20px;
|
| 62 |
+
box-shadow: 8px 8px 0px #000;
|
| 63 |
}
|
| 64 |
.perf-value {
|
| 65 |
+
font-size: 50px;
|
| 66 |
font-weight: 900;
|
| 67 |
color: #0082C3 !important;
|
| 68 |
+
margin: 15px 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
}
|
| 70 |
</style>
|
| 71 |
""", unsafe_allow_html=True)
|
|
|
|
| 85 |
df = load_data()
|
| 86 |
|
| 87 |
# ==============================================================================
|
| 88 |
+
# 3. INTERFACE V2 ÉPURÉE
|
| 89 |
# ==============================================================================
|
| 90 |
if not df.empty:
|
| 91 |
st.markdown("<h1 style='text-align: center;'>🎯 Brake Performance Finder</h1>", unsafe_allow_html=True)
|
|
|
|
| 92 |
|
| 93 |
st.write("")
|
| 94 |
|
| 95 |
+
# Entrées
|
| 96 |
col1, col2 = st.columns(2)
|
| 97 |
|
| 98 |
with col1:
|
|
|
|
| 102 |
model_list = df['model name'].unique().tolist()
|
| 103 |
model_choice = st.selectbox("Modèle (Model)", options=model_list)
|
| 104 |
|
| 105 |
+
# Calcul
|
| 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: 20px; font-weight: bold;">CONDITION : SEC</p>
|
| 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: 20px; font-weight: bold;">CONDITION : HUMIDE</p>
|
| 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("Fichier Excel non trouvé.")
|