MaxBDKT commited on
Commit
0479c4a
·
verified ·
1 Parent(s): 3ff72d7

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +67 -28
src/streamlit_app.py CHANGED
@@ -3,45 +3,83 @@ import pandas as pd
3
  import os
4
 
5
  # ==============================================================================
6
- # 1. STYLE CSS V2 (FOCUS LISIBILITÉ & SAISIE)
7
  # ==============================================================================
8
  st.set_page_config(page_title="Brake Lab V2", layout="centered")
9
 
10
  st.markdown("""
11
  <style>
 
12
  .stApp { background-color: #FFFFFF !important; }
13
  * { color: #000000 !important; font-family: 'Arial', sans-serif; }
14
 
15
- /* STYLE INPUT : Texte BLANC sur fond NOIR (Ta signature) */
16
  input[type="number"] {
17
  color: #FFFFFF !important;
18
  background-color: #1E1E1E !important;
19
  border-radius: 8px !important;
20
  font-weight: bold !important;
21
- font-size: 20px !important;
22
- height: 60px !important;
23
- text-align: center !important;
24
  }
25
 
26
- /* Boite de résultat Performance */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  .perf-box {
28
  padding: 30px;
29
- border: 4px solid #000000;
30
  border-radius: 15px;
31
  background-color: #FFFFFF;
32
  text-align: center;
33
  margin-top: 20px;
 
34
  }
35
  .perf-value {
36
- font-size: 50px;
37
  font-weight: 900;
38
  color: #0082C3 !important;
 
39
  }
40
  </style>
41
  """, unsafe_allow_html=True)
42
 
43
  # ==============================================================================
44
- # 2. DATA
45
  # ==============================================================================
46
  @st.cache_data
47
  def load_data():
@@ -55,52 +93,53 @@ def load_data():
55
  df = load_data()
56
 
57
  # ==============================================================================
58
- # 3. INTERFACE V2 : SAISIE & CALCUL
59
  # ==============================================================================
60
  if not df.empty:
61
- st.title("🎯 Brake Performance Finder")
62
- st.write("Entrez l'effort levier et choisissez votre modèle pour obtenir la performance exacte.")
63
 
64
- col1, col2 = st.columns(2)
 
 
 
65
 
66
- with col1:
67
- # Saisie manuelle de la valeur (40-200N)
68
  effort_val = st.number_input("Effort Levier [N]", min_value=40, max_value=200, value=100, step=1)
69
 
70
- with col2:
71
- # Sélection du modèle
72
  model_list = df['model name'].unique().tolist()
73
  model_choice = st.selectbox("Modèle à tester", options=model_list)
74
 
75
  # --- CALCUL ---
76
  row = df[df['model name'] == model_choice].iloc[0]
77
 
78
- # Formule linéaire : y = ax + b
79
  res_dry = row['dry a'] * effort_val + row['dry b']
80
  res_wet = row['wet a'] * effort_val + row['wet b']
81
 
82
- # --- AFFICHAGE DES RÉSULTATS ---
83
- st.markdown("---")
84
 
85
- res_col1, res_col2 = st.columns(2)
86
 
87
- with res_col1:
88
  st.markdown(f"""
89
  <div class="perf-box">
90
- <p style="font-size: 20px; font-weight: bold;">SOL SEC</p>
91
  <p class="perf-value">{round(res_dry, 1)} N</p>
92
- <p>Force de freinage</p>
93
  </div>
94
  """, unsafe_allow_html=True)
95
 
96
- with res_col2:
97
  st.markdown(f"""
98
  <div class="perf-box">
99
- <p style="font-size: 20px; font-weight: bold;">SOL HUMIDE</p>
100
  <p class="perf-value" style="color: #E63312 !important;">{round(res_wet, 1)} N</p>
101
- <p>Force de freinage</p>
102
  </div>
103
  """, unsafe_allow_html=True)
104
 
105
  else:
106
- st.error("Fichier de données non trouvé.")
 
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 {
64
  padding: 30px;
65
+ border: 3px solid #000000;
66
  border-radius: 15px;
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)
80
 
81
  # ==============================================================================
82
+ # 2. CHARGEMENT DES DONNÉES
83
  # ==============================================================================
84
  @st.cache_data
85
  def load_data():
 
93
  df = load_data()
94
 
95
  # ==============================================================================
96
+ # 3. INTERFACE V2
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>
133
  """, unsafe_allow_html=True)
134
 
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.")