Commit
·
0490b0c
1
Parent(s):
1a0e122
Update app.py
Browse files
app.py
CHANGED
|
@@ -83,14 +83,24 @@ def predire(image, mouvements_selectionnes):
|
|
| 83 |
colors = [MOUVEMENTS_CONFIG[m]["couleur"] for m in classes_triees]
|
| 84 |
|
| 85 |
# === Construction du graphique ===
|
| 86 |
-
fig = go.Figure(go.Bar(
|
| 87 |
x=classes_triees,
|
| 88 |
y=probs_triees,
|
| 89 |
marker=dict(color=colors, line=dict(color='black', width=1)),
|
| 90 |
text=[f"{p*100:.1f}%" for p in probs_triees],
|
| 91 |
textposition='auto',
|
| 92 |
width=LARGEUR_BARRES
|
| 93 |
-
))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
fig.update_layout(
|
| 96 |
xaxis=dict(
|
|
@@ -116,7 +126,8 @@ def predire(image, mouvements_selectionnes):
|
|
| 116 |
font=dict(size=13)
|
| 117 |
)
|
| 118 |
|
| 119 |
-
fig.data[0].textfont = dict(color='black', size=14, family="Arial")
|
|
|
|
| 120 |
|
| 121 |
return fig, gr.update(visible=False)
|
| 122 |
|
|
@@ -130,7 +141,15 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 130 |
|
| 131 |
with gr.Row():
|
| 132 |
with gr.Column(scale=1):
|
| 133 |
-
image_input = gr.Image(type="numpy", label="Importer une œuvre")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
mouvements_checkbox = gr.CheckboxGroup(
|
| 136 |
choices=MOUVEMENTS_DISPONIBLES,
|
|
|
|
| 83 |
colors = [MOUVEMENTS_CONFIG[m]["couleur"] for m in classes_triees]
|
| 84 |
|
| 85 |
# === Construction du graphique ===
|
| 86 |
+
"""fig = go.Figure(go.Bar(
|
| 87 |
x=classes_triees,
|
| 88 |
y=probs_triees,
|
| 89 |
marker=dict(color=colors, line=dict(color='black', width=1)),
|
| 90 |
text=[f"{p*100:.1f}%" for p in probs_triees],
|
| 91 |
textposition='auto',
|
| 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)),
|
| 99 |
+
text=[f"{p*100:.1f}%" for p in probs_triees],
|
| 100 |
+
textposition='inside', # <-- place le texte au centre
|
| 101 |
+
insidetextanchor='middle', # <-- centre verticalement
|
| 102 |
+
width=LARGEUR_BARRES
|
| 103 |
+
))
|
| 104 |
|
| 105 |
fig.update_layout(
|
| 106 |
xaxis=dict(
|
|
|
|
| 126 |
font=dict(size=13)
|
| 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 |
|
|
|
|
| 141 |
|
| 142 |
with gr.Row():
|
| 143 |
with gr.Column(scale=1):
|
| 144 |
+
#image_input = gr.Image(type="numpy", label="Importer une œuvre")
|
| 145 |
+
|
| 146 |
+
image_input = gr.Image(
|
| 147 |
+
type="numpy",
|
| 148 |
+
label="Importer une œuvre",
|
| 149 |
+
height=400, # hauteur fixe
|
| 150 |
+
width=400, # largeur fixe
|
| 151 |
+
elem_classes=["image-fixe"] # optionnel si tu veux styliser
|
| 152 |
+
)
|
| 153 |
|
| 154 |
mouvements_checkbox = gr.CheckboxGroup(
|
| 155 |
choices=MOUVEMENTS_DISPONIBLES,
|