Update app.py
Browse files
app.py
CHANGED
@@ -69,19 +69,19 @@ COMPOSITION_PARAMS = {
|
|
69 |
"Diagonal": "diagonal dynamic composition",
|
70 |
"Minimaliste": "minimal composition with lots of whitespace",
|
71 |
# Nouvelles options ajoutées
|
72 |
-
"Radial": "radial composition with circular arrangement",
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
},
|
78 |
-
|
79 |
# Options existantes
|
80 |
-
|
81 |
-
|
82 |
# Nouvelles options ajoutées
|
83 |
-
|
84 |
-
|
85 |
# Nouvelles ambiances ajoutées
|
86 |
'Serein': "'peaceful' atmosphere for calmness",
|
87 |
'Rétro': "'retro' atmosphere evoking nostalgia",
|
@@ -91,20 +91,20 @@ COMPOSITION_PARAMS = {
|
|
91 |
'Naturel': "'natural' atmosphere with organic elements"
|
92 |
},
|
93 |
'Palette': {
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
}
|
109 |
|
110 |
class ImageGenerator:
|
@@ -154,7 +154,7 @@ class ImageGenerator:
|
|
154 |
try:
|
155 |
logger.info(f"Début de génération avec paramètres: {json.dumps(params)}")
|
156 |
if 'Bearer None' in self.headers['Authorization']:
|
157 |
-
return None,
|
158 |
|
159 |
prompt = self._build_prompt(params)
|
160 |
payload = {
|
@@ -201,7 +201,7 @@ def create_interface():
|
|
201 |
.gradio-slider input[type="range"] { accent-color: #3498db; }
|
202 |
.gradio-button { transition: all 0.3s ease; }
|
203 |
.gradio-button:hover { transform: translateY(-2px); box-shadow: 0 4px 6px rgba(52, 152, 219, 0.11),
|
204 |
-
0 1px 3px rgba(0,
|
205 |
"""
|
206 |
|
207 |
generator = ImageGenerator()
|
@@ -218,29 +218,29 @@ def create_interface():
|
|
218 |
with gr.Group(elem_classes="controls-group"):
|
219 |
gr.Markdown("### 📐 Format et Orientation")
|
220 |
with gr.Row():
|
221 |
-
format_size = gr.Dropdown(choices=["A4",
|
222 |
A3",
|
223 |
A2",
|
224 |
A1",
|
225 |
A0"],
|
226 |
value="A4", label="Format")
|
227 |
-
orientation = gr.Radio(choices=["Portrait",
|
228 |
Paysage"],
|
229 |
value="Portrait", label="Orientation")
|
230 |
|
231 |
with gr.Group(elem_classes="controls-group"):
|
232 |
gr.Markdown("### 🎨 Style et Composition")
|
233 |
with gr.Row():
|
234 |
-
style = gr.Dropdown(choices=list(ART_STYLES.keys()), value="Neo Vintage", label="Style artistique")
|
235 |
-
layout = gr.Dropdown(choices=list(COMPOSITION_PARAMS["Layouts"].keys()), value="Centré", label="Composition")
|
236 |
with gr.Row():
|
237 |
-
ambiance = gr.Dropdown(choices=list(COMPOSITION_PARAMS["Ambiances"].keys()), value="Dramatique", label="Ambiance")
|
238 |
-
palette = gr.Dropdown(choices=list(COMPOSITION_PARAMS["Palette"].keys()), value="Contrasté", label="Palette")
|
239 |
|
240 |
with gr.Group(elem_classes="controls-group"):
|
241 |
gr.Markdown("### 📝 Contenu")
|
242 |
-
subject = gr.Textbox(label="Description", placeholder="Décrivez votre vision...")
|
243 |
-
title = gr.Textbox(label="Titre", placeholder="Titre de l'affiche...")
|
244 |
|
245 |
with gr.Group(elem_classes="advanced-controls"):
|
246 |
gr.Markdown("### 🎯 Ajustements Fins")
|
|
|
69 |
"Diagonal": "diagonal dynamic composition",
|
70 |
"Minimaliste": "minimal composition with lots of whitespace",
|
71 |
# Nouvelles options ajoutées
|
72 |
+
"Radial": "'radial' composition with circular arrangement",
|
73 |
+
'En Z': "'Z-shaped' composition guiding the viewer's eye",
|
74 |
+
'Règle des tiers': "'rule of thirds' composition for balance",
|
75 |
+
'Symétrie': "'symmetrical' composition for mirror-like balance",
|
76 |
+
'Cadre dans le cadre': "'frame within a frame' composition"
|
77 |
},
|
78 |
+
'Ambiances': {
|
79 |
# Options existantes
|
80 |
+
'Dramatique': "'dramatic' lighting with high contrast",
|
81 |
+
'Doux': "'soft' lighting creating a gentle atmosphere",
|
82 |
# Nouvelles options ajoutées
|
83 |
+
'Vibrant': "'vibrant' colors creating an energetic mood",
|
84 |
+
'Mystérieux': "'mysterious' atmosphere with moody lighting",
|
85 |
# Nouvelles ambiances ajoutées
|
86 |
'Serein': "'peaceful' atmosphere for calmness",
|
87 |
'Rétro': "'retro' atmosphere evoking nostalgia",
|
|
|
91 |
'Naturel': "'natural' atmosphere with organic elements"
|
92 |
},
|
93 |
'Palette': {
|
94 |
+
# Options existantes
|
95 |
+
'Monochrome': 'monochromatic color scheme',
|
96 |
+
'Contrasté': 'high contrast color palette',
|
97 |
+
# Nouvelles options ajoutées
|
98 |
+
'Pastel': 'soft pastel color palette',
|
99 |
+
'Terre': 'earthy color palette',
|
100 |
+
# Nouvelles palettes ajoutées
|
101 |
+
'Néon': 'neon color palette',
|
102 |
+
'Complémentaire': 'complementary color scheme',
|
103 |
+
'Analogique': 'analogous color scheme',
|
104 |
+
'Triadique': 'triadic color scheme',
|
105 |
+
'Tétradique': 'tetradic color scheme',
|
106 |
+
'Tons rompus': 'muted tones color palette'
|
107 |
+
}
|
108 |
}
|
109 |
|
110 |
class ImageGenerator:
|
|
|
154 |
try:
|
155 |
logger.info(f"Début de génération avec paramètres: {json.dumps(params)}")
|
156 |
if 'Bearer None' in self.headers['Authorization']:
|
157 |
+
return None,"⚠️ Erreur: Token Hugging Face non configuré"
|
158 |
|
159 |
prompt = self._build_prompt(params)
|
160 |
payload = {
|
|
|
201 |
.gradio-slider input[type="range"] { accent-color: #3498db; }
|
202 |
.gradio-button { transition: all 0.3s ease; }
|
203 |
.gradio-button:hover { transform: translateY(-2px); box-shadow: 0 4px 6px rgba(52, 152, 219, 0.11),
|
204 |
+
0 1px 3px rgba(0 ,0 ,0 ,0.08); }
|
205 |
"""
|
206 |
|
207 |
generator = ImageGenerator()
|
|
|
218 |
with gr.Group(elem_classes="controls-group"):
|
219 |
gr.Markdown("### 📐 Format et Orientation")
|
220 |
with gr.Row():
|
221 |
+
format_size = gr.Dropdown( choices=["A4",
|
222 |
A3",
|
223 |
A2",
|
224 |
A1",
|
225 |
A0"],
|
226 |
value="A4", label="Format")
|
227 |
+
orientation = gr.Radio( choices=["Portrait",
|
228 |
Paysage"],
|
229 |
value="Portrait", label="Orientation")
|
230 |
|
231 |
with gr.Group(elem_classes="controls-group"):
|
232 |
gr.Markdown("### 🎨 Style et Composition")
|
233 |
with gr.Row():
|
234 |
+
style = gr.Dropdown( choices=list(ART_STYLES.keys()), value="Neo Vintage", label="Style artistique")
|
235 |
+
layout = gr.Dropdown( choices=list(COMPOSITION_PARAMS["Layouts"].keys()), value="Centré", label="Composition")
|
236 |
with gr.Row():
|
237 |
+
ambiance = gr.Dropdown( choices=list(COMPOSITION_PARAMS["Ambiances"].keys()), value="Dramatique", label="Ambiance")
|
238 |
+
palette = gr.Dropdown( choices=list(COMPOSITION_PARAMS["Palette"].keys()), value="Contrasté", label="Palette")
|
239 |
|
240 |
with gr.Group(elem_classes="controls-group"):
|
241 |
gr.Markdown("### 📝 Contenu")
|
242 |
+
subject = gr.Textbox( label="Description", placeholder="Décrivez votre vision..." )
|
243 |
+
title = gr.Textbox( label="Titre", placeholder="Titre de l'affiche..." )
|
244 |
|
245 |
with gr.Group(elem_classes="advanced-controls"):
|
246 |
gr.Markdown("### 🎯 Ajustements Fins")
|