Eric2mangel commited on
Commit
e62bcab
·
1 Parent(s): 0490b0c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +59 -2
app.py CHANGED
@@ -92,7 +92,7 @@ def predire(image, mouvements_selectionnes):
92
  width=LARGEUR_BARRES
93
  ))"""
94
 
95
- fig = go.Figure(go.Bar(
96
  x=classes_triees,
97
  y=probs_triees,
98
  marker=dict(color=colors, line=dict(color='black', width=1)),
@@ -127,7 +127,64 @@ def predire(image, mouvements_selectionnes):
127
  )
128
 
129
  #fig.data[0].textfont = dict(color='black', size=14, family="Arial")
130
- fig.data[0].textfont = dict(color='white', size=14, family="Arial") # <-- texte blanc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
 
132
  return fig, gr.update(visible=False)
133
 
 
92
  width=LARGEUR_BARRES
93
  ))"""
94
 
95
+ """fig = go.Figure(go.Bar(
96
  x=classes_triees,
97
  y=probs_triees,
98
  marker=dict(color=colors, line=dict(color='black', width=1)),
 
127
  )
128
 
129
  #fig.data[0].textfont = dict(color='black', size=14, family="Arial")
130
+ fig.data[0].textfont = dict(color='white', size=14, family="Arial") # <-- texte blanc"""
131
+
132
+ # === Construction du graphique ===
133
+ fig = go.Figure(go.Bar(
134
+ x=classes_triees,
135
+ y=probs_triees,
136
+ marker=dict(
137
+ color=colors,
138
+ line=dict(color='rgba(255,255,255,0.6)', width=1.5),
139
+ ),
140
+ text=[f"{p*100:.1f}%" for p in probs_triees],
141
+ textposition='inside',
142
+ insidetextanchor='middle',
143
+ width=LARGEUR_BARRES,
144
+ hovertemplate='%{x}<br>Probabilité : %{y:.1%}<extra></extra>',
145
+ ))
146
+
147
+ # === Amélioration du design général ===
148
+ fig.update_layout(
149
+ template="plotly_white", # base moderne claire
150
+ paper_bgcolor="rgba(0,0,0,0)", # fond transparent
151
+ plot_bgcolor="rgba(245,247,250,1)", # gris bleuté clair moderne
152
+ xaxis=dict(
153
+ fixedrange=True,
154
+ tickangle=45,
155
+ tickfont=dict(size=14, color="#333"),
156
+ automargin=True,
157
+ showline=False,
158
+ zeroline=False
159
+ ),
160
+ yaxis=dict(
161
+ fixedrange=True,
162
+ range=[0, 1],
163
+ title="Probabilité",
164
+ tickfont=dict(size=13, color="#555"),
165
+ gridcolor="rgba(220,220,220,0.4)",
166
+ zeroline=False
167
+ ),
168
+ title=dict(
169
+ text=f"🎨 Mouvements picturaux reconnus (≥ {SEUIL_RECONNAISSANCE*100:.0f}%)",
170
+ y=0.93,
171
+ x=0.5, # centré horizontalement
172
+ xanchor='center',
173
+ font=dict(size=18, color="#333", family="Arial Black")
174
+ ),
175
+ margin=dict(l=60, r=60, t=80, b=80),
176
+ height=HAUTEUR_GRAPHIQUE,
177
+ width=550,
178
+ font=dict(size=13, family="Arial"),
179
+ )
180
+
181
+ # Texte blanc à l’intérieur des barres
182
+ fig.data[0].textfont = dict(color='white', size=14, family="Arial", weight="bold")
183
+
184
+ # Petits arrondis sur les barres
185
+ fig.update_traces(marker_line_width=1.5, marker_line_color="rgba(255,255,255,0.5)",
186
+ marker=dict(cornerradius=5))
187
+
188
 
189
  return fig, gr.update(visible=False)
190