MaxBDKT commited on
Commit
5074dea
·
verified ·
1 Parent(s): 0479c4a

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +57 -40
src/streamlit_app.py CHANGED
@@ -3,61 +3,55 @@ import pandas as pd
3
  import os
4
 
5
  # ==============================================================================
6
- # 1. STYLE CSS V2 (GRILLES DE SÉLECTION BLANC SUR NOIR)
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
- font-size: 22px !important;
23
  }
24
 
25
- /* 1.3 GRILLES DE SÉLECTION (SELECTBOX) : BLANC SUR NOIR */
26
- /* La boite fermée */
27
  div[data-baseweb="select"] {
28
  background-color: #1E1E1E !important;
29
  border: 2px solid #000000 !important;
30
  border-radius: 8px !important;
31
  }
32
-
33
- /* Le texte à l'intérieur de la boite fermée */
34
  div[data-baseweb="select"] div {
35
- color: #FFFFFF !important;
36
- font-weight: bold !important;
37
  }
38
 
39
- /* La liste qui s'ouvre (le menu) */
40
- ul[role="listbox"] {
41
  background-color: #1E1E1E !important;
42
- border: 2px solid #000000 !important;
43
  }
44
-
45
- /* Les options dans la liste */
46
  li[role="option"] {
47
  color: #FFFFFF !important;
48
  background-color: #1E1E1E !important;
49
  font-weight: bold !important;
50
- border-bottom: 1px solid #333 !important;
 
51
  }
52
-
53
- /* Option survolée */
54
- li[role="option"]:hover {
55
  background-color: #0082C3 !important;
56
  color: #FFFFFF !important;
57
  }
58
 
59
- /* 1.4 SUPPRESSION DES ICONES CASSÉES (_arrow) */
60
- svg { fill: #FFFFFF !important; } /* Force les flèches de sélection en blanc */
 
61
 
62
  /* 1.5 CARTES DE RÉSULTATS */
63
  .perf-box {
@@ -67,13 +61,21 @@ st.markdown("""
67
  background-color: #FFFFFF;
68
  text-align: center;
69
  margin-top: 20px;
70
- box-shadow: 5px 5px 0px #000;
71
  }
72
  .perf-value {
73
  font-size: 45px;
74
  font-weight: 900;
75
  color: #0082C3 !important;
76
- margin: 10px 0;
 
 
 
 
 
 
 
 
77
  }
78
  </style>
79
  """, unsafe_allow_html=True)
@@ -97,36 +99,38 @@ df = load_data()
97
  # ==============================================================================
98
  if not df.empty:
99
  st.markdown("<h1 style='text-align: center;'>🎯 Brake Performance Finder</h1>", unsafe_allow_html=True)
100
- st.markdown("<p style='text-align: center;'>Calcul précis de la force de freinage par modèle.</p>", unsafe_allow_html=True)
101
-
102
- st.write("") # Espace
103
 
104
- # Zone de saisie
105
- c1, c2 = st.columns(2)
 
106
 
107
- with c1:
108
  effort_val = st.number_input("Effort Levier [N]", min_value=40, max_value=200, value=100, step=1)
109
 
110
- with c2:
111
  model_list = df['model name'].unique().tolist()
112
- model_choice = st.selectbox("Modèle à tester", options=model_list)
113
 
114
- # --- CALCUL ---
115
  row = df[df['model name'] == model_choice].iloc[0]
116
 
117
- # Formule : y = ax + b
118
- res_dry = row['dry a'] * effort_val + row['dry b']
119
- res_wet = row['wet a'] * effort_val + row['wet b']
 
 
 
 
120
 
121
- # --- AFFICHAGE ---
122
  st.write("")
123
-
124
  res_c1, res_c2 = st.columns(2)
125
 
126
  with res_c1:
127
  st.markdown(f"""
128
  <div class="perf-box">
129
- <p style="font-size: 18px; font-weight: bold; color: #555 !important;">CONDITION : SEC</p>
130
  <p class="perf-value">{round(res_dry, 1)} N</p>
131
  <p style="font-weight: bold;">Force de freinage</p>
132
  </div>
@@ -135,11 +139,24 @@ if not df.empty:
135
  with res_c2:
136
  st.markdown(f"""
137
  <div class="perf-box">
138
- <p style="font-size: 18px; font-weight: bold; color: #555 !important;">CONDITION : HUMIDE</p>
139
  <p class="perf-value" style="color: #E63312 !important;">{round(res_wet, 1)} N</p>
140
  <p style="font-weight: bold;">Force de freinage</p>
141
  </div>
142
  """, unsafe_allow_html=True)
143
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  else:
145
- st.error("Fichier de données non trouvé. Vérifiez la présence du fichier Excel.")
 
3
  import os
4
 
5
  # ==============================================================================
6
+ # 1. STYLE CSS V2 (LISTE DÉROULANTE ULTRA-VISIBLE)
7
  # ==============================================================================
8
  st.set_page_config(page_title="Brake Lab V2", layout="centered")
9
 
10
  st.markdown("""
11
  <style>
12
+ /* 1.1 FOND GLOBAL ET TEXTE */
13
  .stApp { background-color: #FFFFFF !important; }
14
  * { color: #000000 !important; font-family: 'Arial', sans-serif; }
15
 
16
+ /* 1.2 INPUT NUMÉRIQUE (TEXTE 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
  }
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; /* Texte sélectionné en blanc */
 
32
  }
33
 
34
+ /* 1.4 LA LISTE DÉROULANTE (MENU OUVERT) */
35
+ div[role="listbox"] {
36
  background-color: #1E1E1E !important;
 
37
  }
38
+
 
39
  li[role="option"] {
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
+ li[role="option"]:hover, li[aria-selected="true"] {
 
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 {
 
61
  background-color: #FFFFFF;
62
  text-align: center;
63
  margin-top: 20px;
64
+ box-shadow: 6px 6px 0px #000;
65
  }
66
  .perf-value {
67
  font-size: 45px;
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)
 
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:
109
  effort_val = st.number_input("Effort Levier [N]", min_value=40, max_value=200, value=100, step=1)
110
 
111
+ with col2:
112
  model_list = df['model name'].unique().tolist()
113
+ model_choice = st.selectbox("Modèle (Model)", options=model_list)
114
 
115
+ # --- CALCUL & EXTRACTION ---
116
  row = df[df['model name'] == model_choice].iloc[0]
117
 
118
+ # Paramètres Sec
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
+ # --- AFFICHAGE DES RÉSULTATS ---
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: 18px; font-weight: bold;">CONDITION : SEC</p>
134
  <p class="perf-value">{round(res_dry, 1)} N</p>
135
  <p style="font-weight: bold;">Force de freinage</p>
136
  </div>
 
139
  with res_c2:
140
  st.markdown(f"""
141
  <div class="perf-box">
142
+ <p style="font-size: 18px; font-weight: bold;">CONDITION : HUMIDE</p>
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("Données introuvables. Vérifiez le fichier Excel.")