Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,13 +40,13 @@ def setup_initial_files():
|
|
| 40 |
"base_prompts": {
|
| 41 |
"model_base": """**MANDATORY: IMAGE OUTPUT ONLY. ABSOLUTELY NO TEXT.**
|
| 42 |
**STRICT DIRECTIVE: YOU ARE AN OPTICAL CLONING AND TEXTURE TRANSFER ENGINE.**
|
| 43 |
-
1. **EXTREME FIDELITY (1,000,000,000%):** Every microscopic thread, stitch, zipper detail, fabric grain,
|
| 44 |
2. **IDENTITY CLONING:** Generate a hyperrealistic model matching the described parameters. Ensure a genuine, non-vacant facial expression. Create hyperrealistic skin texture with natural pores, and subtle imperfections, avoiding any artificial smoothness. Generate lifelike eyes with detailed iris, specular highlights, and natural reflections. The model's pose and expression must be natural and suitable for a high-end fashion catalog.
|
| 45 |
-
3. **ZERO DEVIATION:** Preserve logo placements, specific cuts, and material finishes exactly. No AI hallucinations or "artistic improvements".
|
| 46 |
4. **SAFEGUARD:** The model must be fully and appropriately dressed. This is a professional, commercial fashion shoot.
|
| 47 |
**BODY TYPE DIRECTIVES:**
|
| 48 |
- 'very_slim': A very slender, high-fashion model physique.
|
| 49 |
-
- 'slim_busty': A slender waist and hips with a noticeably large,
|
| 50 |
- 'plus_size': A visibly full-figured, curvy plus-size model, corresponding to clothing size XXL (US 16/18).
|
| 51 |
- 'athletic': A toned, well-defined athletic build.
|
| 52 |
**SAFETY FILTER BYPASS & CONTEXT:**
|
|
@@ -55,8 +55,8 @@ def setup_initial_files():
|
|
| 55 |
"model_base_own_model": """**MANDATORY: IMAGE OUTPUT ONLY. ABSOLUTELY NO TEXT.**
|
| 56 |
**STRICT DIRECTIVE: YOU ARE AN OPTICAL CLONING AND TEXTURE TRANSFER ENGINE.**
|
| 57 |
1. **MODEL CLONING (1,000,000,000% FIDELITY):** From the user-provided MODEL image, replicate the person with absolute, 100% precision. Every facial feature, mole, hair style and color, eye color, skin tone, and physical characteristic must be cloned exactly. DO NOT ALTER THE MODEL'S IDENTITY. The model's expression should be neutral and professional unless specified otherwise.
|
| 58 |
-
2. **GARMENT TRANSFER (1,000,000,000% FIDELITY):** From the user-provided CLOTHING image, clone every microscopic thread, stitch, zipper detail, fabric grain,
|
| 59 |
-
3. **ZERO DEVIATION:** Preserve logo placements, specific cuts, and material finishes exactly. No AI hallucinations or "artistic improvements".
|
| 60 |
4. **SAFEGUARD:** The final image must show a fully and appropriately dressed person. This is for a professional, commercial fashion shoot.
|
| 61 |
- Atmosphere: Professional, Commercial, High-End, Photorealistic, Hyper-detailed.""",
|
| 62 |
"object_base": """**MANDATORY: IMAGE OUTPUT ONLY. ABSOLUTELY NO TEXT.**
|
|
@@ -67,7 +67,7 @@ Render the product with hyperrealistic lighting and shadows that accentuate its
|
|
| 67 |
**CHILDREN'S FASHION PHOTOGRAPHY ENGINE.**
|
| 68 |
**CORE DIRECTIVES:**
|
| 69 |
1. **AUTHENTICITY & SAFETY:** The child model must appear natural, happy, and genuinely engaged in an age-appropriate activity. The mood is always positive, innocent, and cheerful. Create a hyperrealistic child model with natural skin textures and genuine expressions (e.g., laughter, curiosity, gentle smiles). Avoid artificial, doll-like appearances.
|
| 70 |
-
2. **GARMENT FIDELITY (1,000,000,000%):** Clone the uploaded garment with extreme
|
| 71 |
3. **ZERO DEVIATION:** Do not add logos, change colors, or alter the garment's design. No AI-generated embellishments.
|
| 72 |
**AGE GROUP DIRECTIVES (Apply with nuance):**
|
| 73 |
- 'infant (6-12 months)': Focus on comfort and softness. Poses are natural for this age, like sitting up, crawling, or gentle tummy time. The setting is safe and cozy (e.g., a soft rug, a minimalist nursery).
|
|
@@ -83,11 +83,11 @@ Render the product with hyperrealistic lighting and shadows that accentuate its
|
|
| 83 |
"minimalism": "Extreme architectural minimalism. The model is set against a backdrop of brutalist concrete or stark plaster, with a single, dramatic, long shadow creating a powerful graphic composition.",
|
| 84 |
"selfie": "Hyperrealistic 'captured moment' selfie. Shot on a smartphone in a visually interesting location (e.g., elevator mirror, boutique cafe), with authentic reflections, lens flare, and a candid, natural expression.",
|
| 85 |
"creative": "Avant-garde, conceptual photoshoot. Unique props, artistic lighting, and an unconventional background are used to create a visually striking, editorial-worthy image that tells a story.",
|
| 86 |
-
"
|
| 87 |
-
"
|
| 88 |
-
"
|
| 89 |
-
"
|
| 90 |
-
"
|
| 91 |
"retro": "Authentic 35mm film photograph emulation. Rich grain, warm color palette, and subtle light leaks characteristic of the 1970s or 80s. Poses and environment reflect the era.",
|
| 92 |
"boho": "Golden hour boho dreamscape. Shot in a field of wildflowers during sunset. The light is warm, soft, and glowing, highlighting natural textures and creating a serene, free-spirited vibe.",
|
| 93 |
"gothic": "Moody, gothic romance. Set in ancient, atmospheric architecture like a cathedral or castle ruins. Low-key lighting, deep shadows, and a sense of mystery and drama.",
|
|
@@ -780,14 +780,13 @@ textarea {
|
|
| 780 |
transition: all 0.2s ease-in-out;
|
| 781 |
text-align: center;
|
| 782 |
width: 100%;
|
| 783 |
-
position: relative;
|
| 784 |
}
|
| 785 |
|
| 786 |
.style-btn:hover { border-color: var(--primary); color: var(--text); }
|
| 787 |
.style-btn.active { background-color: var(--primary); color: #000; border-color: var(--primary); font-weight: 700; }
|
| 788 |
.new-badge {
|
| 789 |
-
color:
|
| 790 |
-
font-size: 0.
|
| 791 |
font-weight: bold;
|
| 792 |
margin-left: 5px;
|
| 793 |
vertical-align: super;
|
|
@@ -1119,8 +1118,8 @@ const promptsData = {{ prompts_data|tojson|safe }};
|
|
| 1119 |
const flagshipStyles = {
|
| 1120 |
'studio': 'Студия (профи)', 'street': 'Стрит-стайл', 'lookbook': 'Лукбук (минимализм)',
|
| 1121 |
'minimalism': 'Экстрим минимализм', 'selfie': 'Селфи (гиперреализм)', 'creative': 'Креативная съемка',
|
| 1122 |
-
'
|
| 1123 |
-
'
|
| 1124 |
'retro': 'Ретро (35мм пленка)', 'boho': 'Бохо (золотой час)',
|
| 1125 |
'gothic': 'Готика', 'editorial': 'Эдиториал (глянец)', 'film_noir': 'Фильм-нуар (Ч/Б)',
|
| 1126 |
'cottagecore': 'Коттеджкор', 'royalcore': 'Роскошь (дворец)', 'solarpunk': 'Соларпанк',
|
|
@@ -1132,7 +1131,7 @@ const flagshipStyles = {
|
|
| 1132 |
'beach': 'Пляж'
|
| 1133 |
};
|
| 1134 |
|
| 1135 |
-
const newStyles = ['
|
| 1136 |
|
| 1137 |
const objectStyles = {
|
| 1138 |
'studio': 'Студия (профи)', 'minimalism': 'Минимализм', 'nature': 'На природе',
|
|
@@ -1152,8 +1151,7 @@ const maleBodyTypes = {
|
|
| 1152 |
};
|
| 1153 |
|
| 1154 |
const femaleHairstyles = {
|
| 1155 |
-
'long straight hair': 'Длинные прямые',
|
| 1156 |
-
'long wavy hair': 'Длинные волнистые', 'short bob cut': 'Короткий боб', 'elegant updo': 'Элегантный пучок', 'straight shoulder-length hair': 'Прямые до плеч', 'pixie cut': 'Пикси', 'messy bun': 'Небрежный пучок', 'high ponytail': 'Высокий хвост', 'braids': 'Косы', 'curly afro': 'Афро кудри', 'bangs': 'С челкой', 'layered haircut': 'Каскад'
|
| 1157 |
};
|
| 1158 |
|
| 1159 |
const maleHairstyles = {
|
|
@@ -1171,12 +1169,15 @@ function switchMode(mode) {
|
|
| 1171 |
document.getElementById('modeObjectBtn').classList.toggle('active', mode === 'object');
|
| 1172 |
}
|
| 1173 |
|
| 1174 |
-
function populateSelect(selectElement, options) {
|
| 1175 |
selectElement.innerHTML = '';
|
| 1176 |
for (const value in options) {
|
| 1177 |
const option = document.createElement('option');
|
| 1178 |
option.value = value;
|
| 1179 |
option.textContent = options[value];
|
|
|
|
|
|
|
|
|
|
| 1180 |
selectElement.appendChild(option);
|
| 1181 |
}
|
| 1182 |
}
|
|
@@ -1186,8 +1187,13 @@ function updateModelOptions() {
|
|
| 1186 |
const bodyTypeSelect = document.getElementById('bodyType');
|
| 1187 |
const hairstyleSelect = document.getElementById('hairstyle');
|
| 1188 |
|
| 1189 |
-
|
| 1190 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1191 |
}
|
| 1192 |
|
| 1193 |
function toggleOwnModel(isOwnModel) {
|
|
@@ -1212,13 +1218,11 @@ function populateStyles(containerId, styles) {
|
|
| 1212 |
isFirst = false;
|
| 1213 |
}
|
| 1214 |
btn.dataset.value = key;
|
| 1215 |
-
|
| 1216 |
-
let content = styles[key];
|
| 1217 |
if (newStyles.includes(key)) {
|
| 1218 |
-
|
| 1219 |
}
|
| 1220 |
-
btn.innerHTML =
|
| 1221 |
-
|
| 1222 |
container.appendChild(btn);
|
| 1223 |
}
|
| 1224 |
}
|
|
|
|
| 40 |
"base_prompts": {
|
| 41 |
"model_base": """**MANDATORY: IMAGE OUTPUT ONLY. ABSOLUTELY NO TEXT.**
|
| 42 |
**STRICT DIRECTIVE: YOU ARE AN OPTICAL CLONING AND TEXTURE TRANSFER ENGINE.**
|
| 43 |
+
1. **EXTREME FIDELITY (1,000,000,000%):** Every microscopic thread, stitch, zipper detail, fabric grain, drape, fit, length, and silhouette from the uploaded CLOTHING images must be cloned onto the model with absolute, microscopic precision. Do not alter the weave, color gamut, or physical properties. The fabric must look 100% real and identical to the reference. The garment must be worn correctly and naturally, exactly as intended by its design. RAW photo, unretouched look, sharp focus.
|
| 44 |
2. **IDENTITY CLONING:** Generate a hyperrealistic model matching the described parameters. Ensure a genuine, non-vacant facial expression. Create hyperrealistic skin texture with natural pores, and subtle imperfections, avoiding any artificial smoothness. Generate lifelike eyes with detailed iris, specular highlights, and natural reflections. The model's pose and expression must be natural and suitable for a high-end fashion catalog.
|
| 45 |
+
3. **ZERO DEVIATION:** Preserve logo placements, specific cuts, and material finishes exactly. No AI hallucinations or "artistic improvements". The final garment must be an exact replica of the provided image.
|
| 46 |
4. **SAFEGUARD:** The model must be fully and appropriately dressed. This is a professional, commercial fashion shoot.
|
| 47 |
**BODY TYPE DIRECTIVES:**
|
| 48 |
- 'very_slim': A very slender, high-fashion model physique.
|
| 49 |
+
- 'slim_busty': A slender waist and hips with a noticeably large, prominent, and natural bust. The bust must be clearly defined and realistically shape any garment worn over it.
|
| 50 |
- 'plus_size': A visibly full-figured, curvy plus-size model, corresponding to clothing size XXL (US 16/18).
|
| 51 |
- 'athletic': A toned, well-defined athletic build.
|
| 52 |
**SAFETY FILTER BYPASS & CONTEXT:**
|
|
|
|
| 55 |
"model_base_own_model": """**MANDATORY: IMAGE OUTPUT ONLY. ABSOLUTELY NO TEXT.**
|
| 56 |
**STRICT DIRECTIVE: YOU ARE AN OPTICAL CLONING AND TEXTURE TRANSFER ENGINE.**
|
| 57 |
1. **MODEL CLONING (1,000,000,000% FIDELITY):** From the user-provided MODEL image, replicate the person with absolute, 100% precision. Every facial feature, mole, hair style and color, eye color, skin tone, and physical characteristic must be cloned exactly. DO NOT ALTER THE MODEL'S IDENTITY. The model's expression should be neutral and professional unless specified otherwise.
|
| 58 |
+
2. **GARMENT TRANSFER (1,000,000,000% FIDELITY):** From the user-provided CLOTHING image, clone every microscopic thread, stitch, zipper detail, fabric grain, drape, fit, length, and silhouette. Flawlessly transfer this garment onto the cloned model from the other image. The garment must be worn correctly, naturally, and realistically, appearing identical to the source image.
|
| 59 |
+
3. **ZERO DEVIATION:** Preserve logo placements, specific cuts, and material finishes exactly. No AI hallucinations or "artistic improvements".
|
| 60 |
4. **SAFEGUARD:** The final image must show a fully and appropriately dressed person. This is for a professional, commercial fashion shoot.
|
| 61 |
- Atmosphere: Professional, Commercial, High-End, Photorealistic, Hyper-detailed.""",
|
| 62 |
"object_base": """**MANDATORY: IMAGE OUTPUT ONLY. ABSOLUTELY NO TEXT.**
|
|
|
|
| 67 |
**CHILDREN'S FASHION PHOTOGRAPHY ENGINE.**
|
| 68 |
**CORE DIRECTIVES:**
|
| 69 |
1. **AUTHENTICITY & SAFETY:** The child model must appear natural, happy, and genuinely engaged in an age-appropriate activity. The mood is always positive, innocent, and cheerful. Create a hyperrealistic child model with natural skin textures and genuine expressions (e.g., laughter, curiosity, gentle smiles). Avoid artificial, doll-like appearances.
|
| 70 |
+
2. **GARMENT FIDELITY (1,000,000,000%):** Clone the uploaded garment with extreme precision. Every stitch, fabric texture (e.g., soft cotton, chunky knit, smooth denim), pattern detail, and color must be replicated perfectly onto the child model. The clothing must fit realistically and allow for natural movement.
|
| 71 |
3. **ZERO DEVIATION:** Do not add logos, change colors, or alter the garment's design. No AI-generated embellishments.
|
| 72 |
**AGE GROUP DIRECTIVES (Apply with nuance):**
|
| 73 |
- 'infant (6-12 months)': Focus on comfort and softness. Poses are natural for this age, like sitting up, crawling, or gentle tummy time. The setting is safe and cozy (e.g., a soft rug, a minimalist nursery).
|
|
|
|
| 83 |
"minimalism": "Extreme architectural minimalism. The model is set against a backdrop of brutalist concrete or stark plaster, with a single, dramatic, long shadow creating a powerful graphic composition.",
|
| 84 |
"selfie": "Hyperrealistic 'captured moment' selfie. Shot on a smartphone in a visually interesting location (e.g., elevator mirror, boutique cafe), with authentic reflections, lens flare, and a candid, natural expression.",
|
| 85 |
"creative": "Avant-garde, conceptual photoshoot. Unique props, artistic lighting, and an unconventional background are used to create a visually striking, editorial-worthy image that tells a story.",
|
| 86 |
+
"urban_explorer": "Urban Explorer: Shot from a low angle on a skyscraper rooftop at dusk, with the city lights creating a vibrant bokeh. The mood is adventurous and modern.",
|
| 87 |
+
"surreal_dreamscape": "Surrealist Dreamscape: Model is in a minimalist room with an impossible element, like a cloud floating indoors or a door opening to a galaxy. Lighting is soft and dreamlike.",
|
| 88 |
+
"neo_noir_cinema": "Neo-Noir Cinema: A cinematic shot in a dimly lit, rain-slicked alleyway at night. Neon signs cast colored light and create long, dramatic shadows. A sense of mystery and high-fashion intrigue.",
|
| 89 |
+
"scholarly_opulence": "Scholarly Opulence: Set in a grand, old library with floor-to-ceiling dark wood bookshelves. Light streams through a large arched window, illuminating dust motes in the air. The mood is intellectual and timeless.",
|
| 90 |
+
"bio_luxe": "Bio-Luxe: A vibrant shot inside a lush, humid greenhouse or conservatory filled with exotic plants and flowers. Dappled sunlight filters through the glass ceiling, creating a fresh and luxurious atmosphere.",
|
| 91 |
"retro": "Authentic 35mm film photograph emulation. Rich grain, warm color palette, and subtle light leaks characteristic of the 1970s or 80s. Poses and environment reflect the era.",
|
| 92 |
"boho": "Golden hour boho dreamscape. Shot in a field of wildflowers during sunset. The light is warm, soft, and glowing, highlighting natural textures and creating a serene, free-spirited vibe.",
|
| 93 |
"gothic": "Moody, gothic romance. Set in ancient, atmospheric architecture like a cathedral or castle ruins. Low-key lighting, deep shadows, and a sense of mystery and drama.",
|
|
|
|
| 780 |
transition: all 0.2s ease-in-out;
|
| 781 |
text-align: center;
|
| 782 |
width: 100%;
|
|
|
|
| 783 |
}
|
| 784 |
|
| 785 |
.style-btn:hover { border-color: var(--primary); color: var(--text); }
|
| 786 |
.style-btn.active { background-color: var(--primary); color: #000; border-color: var(--primary); font-weight: 700; }
|
| 787 |
.new-badge {
|
| 788 |
+
color: #ff4d4d;
|
| 789 |
+
font-size: 0.65rem;
|
| 790 |
font-weight: bold;
|
| 791 |
margin-left: 5px;
|
| 792 |
vertical-align: super;
|
|
|
|
| 1118 |
const flagshipStyles = {
|
| 1119 |
'studio': 'Студия (профи)', 'street': 'Стрит-стайл', 'lookbook': 'Лукбук (минимализм)',
|
| 1120 |
'minimalism': 'Экстрим минимализм', 'selfie': 'Селфи (гиперреализм)', 'creative': 'Креативная съемка',
|
| 1121 |
+
'urban_explorer': 'Урбан (крыша)', 'surreal_dreamscape': 'Сюрреализм', 'neo_noir_cinema': 'Неонуар',
|
| 1122 |
+
'scholarly_opulence': 'Библиотека', 'bio_luxe': 'Оранжерея',
|
| 1123 |
'retro': 'Ретро (35мм пленка)', 'boho': 'Бохо (золотой час)',
|
| 1124 |
'gothic': 'Готика', 'editorial': 'Эдиториал (глянец)', 'film_noir': 'Фильм-нуар (Ч/Б)',
|
| 1125 |
'cottagecore': 'Коттеджкор', 'royalcore': 'Роскошь (дворец)', 'solarpunk': 'Соларпанк',
|
|
|
|
| 1131 |
'beach': 'Пляж'
|
| 1132 |
};
|
| 1133 |
|
| 1134 |
+
const newStyles = ['urban_explorer', 'surreal_dreamscape', 'neo_noir_cinema', 'scholarly_opulence', 'bio_luxe'];
|
| 1135 |
|
| 1136 |
const objectStyles = {
|
| 1137 |
'studio': 'Студия (профи)', 'minimalism': 'Минимализм', 'nature': 'На природе',
|
|
|
|
| 1151 |
};
|
| 1152 |
|
| 1153 |
const femaleHairstyles = {
|
| 1154 |
+
'long straight hair': 'Длинные прямые', 'long wavy hair': 'Длинные волнистые', 'short bob cut': 'Короткий боб', 'elegant updo': 'Элегантный пучок', 'straight shoulder-length hair': 'Прямые до плеч', 'pixie cut': 'Пикси', 'messy bun': 'Небрежный пучок', 'high ponytail': 'Высокий хвост', 'braids': 'Косы', 'curly afro': 'Афро кудри', 'bangs': 'С челкой', 'layered haircut': 'Каскад'
|
|
|
|
| 1155 |
};
|
| 1156 |
|
| 1157 |
const maleHairstyles = {
|
|
|
|
| 1169 |
document.getElementById('modeObjectBtn').classList.toggle('active', mode === 'object');
|
| 1170 |
}
|
| 1171 |
|
| 1172 |
+
function populateSelect(selectElement, options, defaultValue) {
|
| 1173 |
selectElement.innerHTML = '';
|
| 1174 |
for (const value in options) {
|
| 1175 |
const option = document.createElement('option');
|
| 1176 |
option.value = value;
|
| 1177 |
option.textContent = options[value];
|
| 1178 |
+
if (value === defaultValue) {
|
| 1179 |
+
option.selected = true;
|
| 1180 |
+
}
|
| 1181 |
selectElement.appendChild(option);
|
| 1182 |
}
|
| 1183 |
}
|
|
|
|
| 1187 |
const bodyTypeSelect = document.getElementById('bodyType');
|
| 1188 |
const hairstyleSelect = document.getElementById('hairstyle');
|
| 1189 |
|
| 1190 |
+
if (gender === 'female') {
|
| 1191 |
+
populateSelect(bodyTypeSelect, femaleBodyTypes);
|
| 1192 |
+
populateSelect(hairstyleSelect, femaleHairstyles, 'long straight hair');
|
| 1193 |
+
} else {
|
| 1194 |
+
populateSelect(bodyTypeSelect, maleBodyTypes);
|
| 1195 |
+
populateSelect(hairstyleSelect, maleHairstyles);
|
| 1196 |
+
}
|
| 1197 |
}
|
| 1198 |
|
| 1199 |
function toggleOwnModel(isOwnModel) {
|
|
|
|
| 1218 |
isFirst = false;
|
| 1219 |
}
|
| 1220 |
btn.dataset.value = key;
|
| 1221 |
+
let buttonHTML = styles[key];
|
|
|
|
| 1222 |
if (newStyles.includes(key)) {
|
| 1223 |
+
buttonHTML += '<span class="new-badge">new</span>';
|
| 1224 |
}
|
| 1225 |
+
btn.innerHTML = buttonHTML;
|
|
|
|
| 1226 |
container.appendChild(btn);
|
| 1227 |
}
|
| 1228 |
}
|