Kgshop commited on
Commit
7050fa0
·
verified ·
1 Parent(s): dd7e46f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -27
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, pattern, length, fit, drape, 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. The garment must be worn correctly and naturally. The final garment on the model must be indistinguishable from the source image. 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". NO artistic interpretation or alteration is permitted.
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, full, and prominent bust (DD+ cup size), clearly visible and well-defined even under clothing. The silhouette must emphasize the contrast between the slim frame and the large bust.
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, pattern, length, fit, drape and silhouette. Flawlessly transfer this garment onto the cloned model from the other image with absolute, microscopic precision. The garment must be worn correctly, naturally, and realistically. The final garment on the model must be indistinguishable from the source image.
59
- 3. **ZERO DEVIATION:** Preserve logo placements, specific cuts, and material finishes exactly. No AI hallucinations or "artistic improvements". NO artistic interpretation or alteration is permitted.
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, microscopic precision. Every stitch, fabric texture (e.g., soft cotton, chunky knit, smooth denim), pattern detail, length, fit, drape 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,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
- "dutch_masters": "Artistic photoshoot in the style of a Dutch Masters painting. Dramatic, low-key 'chiaroscuro' lighting, reminiscent of Rembrandt or Vermeer. The light sculpts the model and emphasizes the rich texture, drape, and deep colors of the fabric against a dark, moody background. The atmosphere is timeless, painterly, and deeply focused on the material quality of the clothing.",
87
- "surrealist_dreamscape": "Conceptual fashion shot in a surreal, dream-like landscape. Think Dali-esque melting clocks, Escher's impossible architecture, or floating geometric shapes. The lighting is otherworldly and illogical, casting strange shadows and creating a bizarre, high-art context that makes the clothing the only 'real' object in the frame.",
88
- "kinetic_light": "Dynamic long-exposure photoshoot in a darkened studio or urban night setting. Abstract trails of colored light are 'painted' around the model, creating a kinetic, energetic frame that outlines the silhouette of the outfit. The model remains in sharp focus while the light swirls around them, creating a futuristic and visually arresting image.",
89
- "prismatic_flare": "High-fashion editorial shot using an anamorphic or specially modified lens to create dramatic, artistic prismatic and rainbow lens flares. The flare becomes a compositional element, streaking across the image and interacting with the model. The background is bokeh-rich, making the clothing and the ethereal light the main focus.",
90
- "submerged_hues": "Artistic shot with the model partially submerged in or interacting with clear, still water that is dyed a vibrant color. The interaction between the fabric and the colored liquid creates beautiful, unpredictable patterns, reflections, and refractions. The focus is on the texture of the wet clothing and the serene, yet intense, visual created by the saturated color.",
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: var(--danger);
790
- font-size: 0.6rem;
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
- 'dutch_masters': 'Свет Рембрандта', 'surrealist_dreamscape': 'Сюрреализм', 'kinetic_light': 'Рисование светом',
1123
- 'prismatic_flare': 'Призматические блики', 'submerged_hues': 'В цветной воде',
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 = ['dutch_masters', 'surrealist_dreamscape', 'kinetic_light', 'prismatic_flare', 'submerged_hues'];
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
- populateSelect(bodyTypeSelect, gender === 'female' ? femaleBodyTypes : maleBodyTypes);
1190
- populateSelect(hairstyleSelect, gender === 'female' ? femaleHairstyles : maleHairstyles);
 
 
 
 
 
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
- content += `<span class="new-badge">NEW</span>`;
1219
  }
1220
- btn.innerHTML = content;
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
  }