generart / prompt_enhancer.py
Equityone's picture
Update prompt_enhancer.py
bf34d04 verified
raw
history blame
2.72 kB
from typing import Dict, List, Optional
import logging
import re
logger = logging.getLogger(__name__)
class PromptEnhancer:
def __init__(self):
self.context_keywords = {
# Éléments de design
"moderne": "modern clean professional design",
"vintage": "vintage retro classic design",
"minimaliste": "minimalist clean simple design",
"luxe": "luxury elegant premium design",
# Types d'ambiance
"professionnel": "professional corporate business-like",
"créatif": "creative artistic innovative",
"dynamique": "dynamic energetic vibrant",
"élégant": "elegant sophisticated refined",
# Éléments visuels
"logo": "prominent logo design professional branding",
"texte": "clear readable text typography",
"image": "main visual focal point image",
"photo": "photographic image realistic",
# Caractéristiques techniques
"haute qualité": "high quality professional grade",
"détaillé": "highly detailed intricate",
"net": "sharp crisp clear",
"flou": "soft focus gentle blur",
# Styles spécifiques
"3D": "three dimensional depth realistic",
"plat": "flat design 2D clean",
"graphique": "graphic design vector-style",
"illustré": "illustrated hand-drawn artistic"
}
self.composition_patterns = {
# Structure de l'affiche
"haut": "top aligned composition with {element}",
"bas": "bottom aligned composition with {element}",
"centre": "centered composition with {element}",
"gauche": "left aligned composition with {element}",
"droite": "right aligned composition with {element}",
# Relations spatiales
"au-dessus": "{element1} positioned above {element2}",
"en-dessous": "{element1} positioned below {element2}",
"à côté": "{element1} next to {element2}",
"autour": "{element1} surrounding {element2}"
}
self.emphasis_patterns = {
"important": "(({})),", # Double emphase
"normal": "({}),", # Emphase simple
"subtil": "[{}]," # Emphase légère
}
# Expressions courantes à optimiser
self.common_improvements = {
"faire": "create",
"mettre": "place",
"avec": "featuring",
"contenant": "containing",
"il y a": "featuring"