Update prompt_enhancer.py
Browse files- prompt_enhancer.py +68 -1
prompt_enhancer.py
CHANGED
@@ -1 +1,68 @@
|
|
1 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import Dict, List, Optional
|
2 |
+
import logging
|
3 |
+
import re
|
4 |
+
|
5 |
+
logger = logging.getLogger(__name__)
|
6 |
+
|
7 |
+
class PromptEnhancer:
|
8 |
+
def __init__(self):
|
9 |
+
self.context_keywords = {
|
10 |
+
# Éléments de design
|
11 |
+
"moderne": "modern clean professional design",
|
12 |
+
"vintage": "vintage retro classic design",
|
13 |
+
"minimaliste": "minimalist clean simple design",
|
14 |
+
"luxe": "luxury elegant premium design",
|
15 |
+
|
16 |
+
# Types d'ambiance
|
17 |
+
"professionnel": "professional corporate business-like",
|
18 |
+
"créatif": "creative artistic innovative",
|
19 |
+
"dynamique": "dynamic energetic vibrant",
|
20 |
+
"élégant": "elegant sophisticated refined",
|
21 |
+
|
22 |
+
# Éléments visuels
|
23 |
+
"logo": "prominent logo design professional branding",
|
24 |
+
"texte": "clear readable text typography",
|
25 |
+
"image": "main visual focal point image",
|
26 |
+
"photo": "photographic image realistic",
|
27 |
+
|
28 |
+
# Caractéristiques techniques
|
29 |
+
"haute qualité": "high quality professional grade",
|
30 |
+
"détaillé": "highly detailed intricate",
|
31 |
+
"net": "sharp crisp clear",
|
32 |
+
"flou": "soft focus gentle blur",
|
33 |
+
|
34 |
+
# Styles spécifiques
|
35 |
+
"3D": "three dimensional depth realistic",
|
36 |
+
"plat": "flat design 2D clean",
|
37 |
+
"graphique": "graphic design vector-style",
|
38 |
+
"illustré": "illustrated hand-drawn artistic"
|
39 |
+
}
|
40 |
+
|
41 |
+
self.composition_patterns = {
|
42 |
+
# Structure de l'affiche
|
43 |
+
"haut": "top aligned composition with {element}",
|
44 |
+
"bas": "bottom aligned composition with {element}",
|
45 |
+
"centre": "centered composition with {element}",
|
46 |
+
"gauche": "left aligned composition with {element}",
|
47 |
+
"droite": "right aligned composition with {element}",
|
48 |
+
|
49 |
+
# Relations spatiales
|
50 |
+
"au-dessus": "{element1} positioned above {element2}",
|
51 |
+
"en-dessous": "{element1} positioned below {element2}",
|
52 |
+
"à côté": "{element1} next to {element2}",
|
53 |
+
"autour": "{element1} surrounding {element2}"
|
54 |
+
}
|
55 |
+
|
56 |
+
self.emphasis_patterns = {
|
57 |
+
"important": "(({})),", # Double emphase
|
58 |
+
"normal": "({}),", # Emphase simple
|
59 |
+
"subtil": "[{}]," # Emphase légère
|
60 |
+
}
|
61 |
+
|
62 |
+
# Expressions courantes à optimiser
|
63 |
+
self.common_improvements = {
|
64 |
+
"faire": "create",
|
65 |
+
"mettre": "place",
|
66 |
+
"avec": "featuring",
|
67 |
+
"contenant": "containing",
|
68 |
+
"il y a": "featuring"
|