BATUTO-ART commited on
Commit
ea5bac5
·
verified ·
1 Parent(s): 1172cf3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +155 -654
app.py CHANGED
@@ -1,681 +1,182 @@
1
- import gradio as gr
2
  import random
3
- from typing import Dict, Any, List
4
- import json
5
- import datetime
6
-
7
- class HyperRealisticConfig:
8
- ETHNICITIES = [
9
- "Mediterranean", "Scandinavian", "Slavic", "Latin American",
10
- "Middle Eastern", "East Asian", "South Asian", "African",
11
- "Caribbean", "Polynesian", "Mixed Heritage"
12
- ]
13
-
14
- BODY_TYPES = [
15
- "athletic slender", "voluptuous curves", "petite feminine",
16
- "toned hourglass", "soft natural", "elegant tall"
17
- ]
18
-
19
- SKIN_DETAILS = [
20
- "with subtle freckles and skin texture", "with dewy natural complexion",
21
- "showing realistic skin pores and veins", "with natural skin imperfections",
22
- "with subsurface scattering effect", "with delicate skin translucency"
23
- ]
24
-
25
- PROFESSIONAL_ROLES = [
26
- {
27
- "role": "Executive Secretary",
28
- "uniform": "form-fitting tailored black dress with silk blouse slightly unbuttoned",
29
- "environment": "luxurious corporate office with marble floors",
30
- "accessories": "slim tablet and leather portfolio",
31
- "pose": "bending over conference table arranging documents"
32
- },
33
- {
34
- "role": "Luxury Hotel Manager",
35
- "uniform": "elegant navy blue blazer and pencil skirt riding up when seated",
36
- "environment": "five-star hotel lobby with golden lighting",
37
- "accessories": "gold name tag and master key cards",
38
- "pose": "leaning forward to assist guest at reception"
39
- },
40
- {
41
- "role": "Fashion Boutique Manager",
42
- "uniform": "chic black designer dress with elegant draping that accents curves",
43
- "environment": "high-end boutique with minimalist decor and spotlights",
44
- "accessories": "designer handbag and inventory clipboard",
45
- "pose": "kneeling to adjust mannequin display"
46
- },
47
- {
48
- "role": "Corporate Lawyer",
49
- "uniform": "sharp charcoal gray pantsuit with skirt hiking up when walking",
50
- "environment": "modern law firm with floor-to-ceiling windows",
51
- "accessories": "leather briefcase and legal documents",
52
- "pose": "stretching to reach high shelf in law library"
53
- },
54
- {
55
- "role": "Private Jet Attendant",
56
- "uniform": "custom-fitted aviation uniform with skirt shortening when bending",
57
- "environment": "luxurious private jet cabin with leather seats",
58
- "accessories": "champagne flute and service tray",
59
- "pose": "bending to serve passengers in low cabin"
60
- },
61
- {
62
- "role": "Art Gallery Curator",
63
- "uniform": "sleek black turtleneck and high-waisted trousers with visible panty lines",
64
- "environment": "contemporary art gallery with dramatic lighting",
65
- "accessories": "curator's catalog and white gloves",
66
- "pose": "squatting to examine lower artwork"
67
- },
68
- {
69
- "role": "University Professor",
70
- "uniform": "elegant tweed blazer and knee-length skirt that rides up when seated",
71
- "environment": "university library with wooden ladders",
72
- "accessories": "academic books and reading glasses",
73
- "pose": "reaching for book on high shelf"
74
- },
75
- {
76
- "role": "Ballet Instructor",
77
- "uniform": "black leotard with wrap skirt and visible dance belt lines",
78
- "environment": "dance studio with wall mirrors and barre",
79
- "accessories": "pointe shoe ribbon and demonstration stick",
80
- "pose": "demonstrating deep plié at barre"
81
- },
82
- {
83
- "role": "Yacht Stewardess",
84
- "uniform": "crisp white polo and navy shorts that tighten when bending",
85
- "environment": "luxury yacht deck at sunset with teak flooring",
86
- "accessories": "silver tray with cocktails and nautical rope",
87
- "pose": "leaning over side to adjust fenders"
88
- },
89
- {
90
- "role": "Elegant Maid",
91
- "uniform": "classic black maid dress with white lace apron that flips up",
92
- "environment": "opulent mansion hallway with grand staircase",
93
- "accessories": "feather duster and cleaning cart",
94
- "pose": "bending to polish banister"
95
- }
96
- ]
97
-
98
- EVERYDAY_MOMENTS = [
99
- {
100
- "scene": "Morning Kitchen",
101
- "action": "bending down to take something from the low oven causing shirt to rise",
102
- "outfit": "oversized white t-shirt and cotton shorts with visible panty lines",
103
- "setting": "sunlit kitchen with open window and morning light",
104
- "accessories": "coffee mug on counter, apron hanging, fresh herbs",
105
- "pose": "natural bending with back arched"
106
- },
107
- {
108
- "scene": "Laundry Room",
109
- "action": "bending over to take clothes from the dryer showing waistband",
110
- "outfit": "sports top and fitted leggings with subtle sheer panels",
111
- "setting": "laundry room with baskets and folding table",
112
- "accessories": "basket of clean clothes, fabric softener",
113
- "pose": "deep forward bend with legs straight"
114
- },
115
- {
116
- "scene": "Gardening",
117
- "action": "kneeling while planting flowers with shorts riding up",
118
- "outfit": "light cotton sundress with thin straps and no bra lines",
119
- "setting": "backyard garden with flower pots and watering system",
120
- "accessories": "gardening gloves, watering can, trowel",
121
- "pose": "kneeling with one leg forward"
122
- },
123
- {
124
- "scene": "Home Yoga",
125
- "action": "doing downward dog pose with leggings becoming translucent",
126
- "outfit": "yoga leggings and crop top with sweat patches",
127
- "setting": "living room with yoga mat and natural side lighting",
128
- "accessories": "yoga block, water bottle, meditation app",
129
- "pose": "inverted V-shape with head down"
130
- },
131
- {
132
- "scene": "Shelf Cleaning",
133
- "action": "stretching on tiptoes to reach a book showing midriff",
134
- "outfit": "loose t-shirt and pajama shorts with lace trim visible",
135
- "setting": "personal library with small ladder and dust particles",
136
- "accessories": "feather duster, stack of books, reading glasses",
137
- "pose": "full body stretch on toes"
138
- },
139
- {
140
- "scene": "Dog Walk",
141
- "action": "bending down to attach the leash with dress gaping",
142
- "outfit": "floral summer dress with thin fabric blowing in wind",
143
- "setting": "park at sunset with long shadows and golden hour",
144
- "accessories": "leash, treat pouch, dog water bottle",
145
- "pose": "squatting while holding excited dog"
146
- },
147
- {
148
- "scene": "Terrace Coffee",
149
- "action": "sitting with legs crossed, dropping a napkin and reaching",
150
- "outfit": "silk blouse and pleated skirt that opens when seated",
151
- "setting": "terrace with iron table and morning mist",
152
- "accessories": "open book, tea cup, croissant",
153
- "pose": "leaning forward from seated position"
154
- },
155
- {
156
- "scene": "Climbing Stairs",
157
- "action": "going up with shopping bags showing back view",
158
- "outfit": "pencil skirt and fitted blouse with tension lines",
159
- "setting": "spiral staircase in apartment with dramatic lighting",
160
- "accessories": "shopping bags, keys in hand, mail",
161
- "pose": "mid-step with weight on one leg"
162
- },
163
- {
164
- "scene": "Changing Lightbulb",
165
- "action": "standing on a chair with arms raised fully",
166
- "outfit": "long t-shirt as dress with back lift when reaching",
167
- "setting": "kitchen with pendant light and afternoon shadows",
168
- "accessories": "new lightbulb, step stool, tool box",
169
- "pose": "tiptoes on chair reaching upward"
170
- },
171
- {
172
- "scene": "Post-Shower",
173
- "action": "drying hair with towel that keeps slipping",
174
- "outfit": "short towel wrapped tightly with damp edges",
175
- "setting": "bathroom with foggy mirror and steam effect",
176
- "accessories": "hairdryer, bathrobe on hook, skincare products",
177
- "pose": "bent forward hair drying motion"
178
- }
179
- ]
180
-
181
- LACE_BIKINI_STYLES = [
182
- "delicate black lace bikini with floral embroidery and sheer panels",
183
- "sheer nude illusion bikini with scalloped lace edges and ribbon ties",
184
- "burgundy silk bikini with Chantilly lace inserts and satin strings",
185
- "ivory French lace bikini with pearl accents and delicate stitching",
186
- "champagne colored lace bikini with geometric patterns and silk backing",
187
- "deep emerald lace bikini with velvet trim and adjustable sides",
188
- "rose gold metallic lace bikini with transparent mesh panels",
189
- "midnight blue lace bikini with crystal beading and underwire support"
190
- ]
191
-
192
- HOSIERY_STYLES = [
193
- "black sheer thigh-high stockings with lace tops and stay-up silicone",
194
- "nude ultra-sheer stockings with reinforced toes and back seam",
195
- "fishnet thigh-highs with delicate diamond pattern and satin band",
196
- "back-seam stockings with Cuban heel and vintage reinforcement",
197
- "sheer to waist stockings with lace panel and no panty line",
198
- "opaque tights with subtle sheen and reinforced gusset",
199
- "stay-up stockings with French lace band and bow details",
200
- "glossy finish stockings with sandalwood foot and sheer legs"
201
- ]
202
-
203
- HEEL_STYLES = [
204
- "black patent leather stilettos with pointed toe and slim heel",
205
- "nude pumps with platform and ankle strap for stability",
206
- "gold strappy sandals with multiple thin straps and high arch",
207
- "black suede pointed-toe heels with cut-out details",
208
- "red bottom Louboutin-style heels with glossy finish",
209
- "clear PVC heels with geometric shapes and metallic accents",
210
- "silver glitter block heels with ankle support and comfort pad",
211
- "white leather slingbacks with kitten heel and bow detail"
212
- ]
213
-
214
- HAIRSTYLES = [
215
- "long wavy hair with natural volume and soft highlights",
216
- "sleek straight hair with middle part and glossy finish",
217
- "elegant updo with loose tendrils and pearl pins",
218
- "beach waves with sun-kissed highlights and textured ends",
219
- "high ponytail with smooth finish and subtle curls",
220
- "braided crown with floral accents and soft flyaways",
221
- "vintage Hollywood curls with deep side part",
222
- "messy bun with face-framing strands and natural texture"
223
- ]
224
-
225
- MAKEUP_STYLES = [
226
- "natural glam with dewy skin, soft contour, and nude lips",
227
- "smoky eye with winged liner and voluminous lashes",
228
- "rosy cheeks with glossy lips and subtle highlighter",
229
- "bold red lip with flawless matte foundation",
230
- "bronzed goddess with shimmery eyeshadow and golden highlights",
231
- "minimalist makeup with tinted moisturizer and mascara",
232
- "vintage pin-up with defined brows and classic red lip",
233
- "ethereal glow with iridescent highlighter and soft blush"
234
- ]
235
-
236
- LIGHTING_DETAILS = [
237
- "soft diffused lighting with a warm golden glow",
238
- "dramatic chiaroscuro lighting with deep shadows",
239
- "natural sunlight filtering through sheer curtains",
240
- "studio lighting with a three-point setup for dimensionality",
241
- "candlelit ambiance with flickering shadows",
242
- "backlit silhouette with a soft halo effect",
243
- "moody blue-toned lighting for a cinematic feel",
244
- "sunset glow with lens flare and warm hues"
245
- ]
246
-
247
- PHOTOGRAPHY_STYLES = [
248
- "cinematic lighting with rim light and soft shadows",
249
- "natural window light with lens flare and soft focus",
250
- "studio softbox lighting with catchlights in eyes",
251
- "golden hour backlighting with hair light effect",
252
- "moody low-key lighting with dramatic contrasts",
253
- "bright high-key lighting with minimal shadows",
254
- "film noir inspired lighting with venetian blind patterns",
255
- "ethereal foggy lighting with diffusion filter"
256
- ]
257
-
258
- CAMERAS = ["Canon EOS R5", "Sony α7R V", "Nikon Z9", "Hasselblad X2D", "Phase One IQ4"]
259
- LENSES = ["85mm f/1.2", "50mm f/1.4", "24-70mm f/2.8", "100mm f/2.8 macro", "135mm f/1.8"]
260
-
261
 
262
- class HyperRealisticPromptGenerator:
263
  def __init__(self):
264
- self.config = HyperRealisticConfig()
265
- self.history: List[Dict] = []
266
-
267
- def _get_role_by_name(self, name: str) -> Dict:
268
- return next((r for r in self.config.PROFESSIONAL_ROLES if r["role"] == name), self.config.PROFESSIONAL_ROLES[0])
269
-
270
- def _get_moment_by_name(self, name: str) -> Dict:
271
- return next((m for m in self.config.EVERYDAY_MOMENTS if m["scene"] == name), self.config.EVERYDAY_MOMENTS[0])
272
-
273
- def _random_style(self):
274
- return (
275
- random.choice(self.config.BODY_TYPES),
276
- random.choice(self.config.SKIN_DETAILS),
277
- random.choice(self.config.LACE_BIKINI_STYLES),
278
- random.choice(self.config.HOSIERY_STYLES),
279
- random.choice(self.config.HEEL_STYLES),
280
- random.choice(self.config.HAIRSTYLES),
281
- random.choice(self.config.MAKEUP_STYLES),
282
- random.choice(self.config.LIGHTING_DETAILS),
283
- random.choice(self.config.PHOTOGRAPHY_STYLES),
284
- random.choice(self.config.CAMERAS),
285
- random.choice(self.config.LENSES)
286
- )
287
-
288
- def generate_role_prompt(self, ethnicity: str, role_name: str, nsfw_mode: bool = False) -> str:
289
- role = self._get_role_by_name(role_name)
290
- body, skin, lace, hosiery, heels, hairstyle, makeup, lighting, photo_style, camera, lens = self._random_style()
291
 
292
- if nsfw_mode:
293
- reveal = f"subtle reveal of {lace} through clothing during {role['pose']}"
294
- underwear_desc = f"wearing {lace} under {role['uniform']}"
295
- nudity = "artistic sensuality with focus on natural beauty"
296
- else:
297
- reveal = f"subtle hint of lace underwear during {role['pose']}"
298
- underwear_desc = f"with delicate lace underwear under {role['uniform']}"
299
- nudity = "elegant and professional with subtle sensuality"
300
-
301
- prompt = (
302
- f"Hyper-realistic 4K photograph, 9:16 vertical composition, full-body portrait from dynamic low angle, "
303
- f"of a stunning {ethnicity.lower()} {role['role']} with {body} figure {skin}, "
304
- f"{underwear_desc}, {hosiery}, {heels}, styled with {hairstyle}, and {makeup}. "
305
- f"In {role['environment']}, captured during {role['pose']} causing {reveal}. "
306
- f"{lighting}, {photo_style}, Camera: {camera} with {lens} lens, professional lighting setup, "
307
- f"ultra-high resolution 16K, extreme detail showing skin texture with visible pores, "
308
- f"realistic fabric wrinkles, subsurface scattering effect, cinematic depth of field. "
309
- f"Professional atmosphere, elegant composition, {nudity}. "
310
- f"Include {role['accessories']} in scene. --no explicit_nudity --style raw --stylize 150"
311
- )
312
-
313
- self.history.append({
314
- "type": "role",
315
- "ethnicity": ethnicity,
316
- "role": role_name,
317
- "nsfw": nsfw_mode,
318
- "prompt": prompt,
319
- "timestamp": datetime.datetime.now().isoformat()
320
- })
321
- return prompt
322
- def generate_moment_prompt(self, ethnicity: str, moment_name: str, nsfw_mode: bool = False) -> str:
323
- moment = self._get_moment_by_name(moment_name)
324
- body, skin, lace, hosiery, heels, hairstyle, makeup, lighting, photo_style, camera, lens = self._random_style()
325
-
326
- if nsfw_mode:
327
- reveal = f"natural reveal of {lace} while {moment['action']}"
328
- underwear_desc = f"wearing {lace} under {moment['outfit']}"
329
- sensuality = "artistic intimate moment with sensual atmosphere"
330
- else:
331
- reveal = f"subtle suggestion of lace underwear while {moment['action']}"
332
- underwear_desc = f"with delicate lace underwear under {moment['outfit']}"
333
- sensuality = "natural private moment with elegant sensuality"
334
-
335
- prompt = (
336
- f"Hyper-realistic candid photograph, 9:16 vertical format, intimate low angle perspective, "
337
- f"of a beautiful {ethnicity.lower()} woman with {body} physique {skin}, styled with {hairstyle}, and {makeup}. "
338
- f"{underwear_desc}, {hosiery}, {heels}, in {moment['setting']}, "
339
- f"captured during {moment['pose']}, {moment['action']}. "
340
- f"{lighting}, {photo_style}, Camera: {camera} with {lens}, ultra-high detail 16K resolution, "
341
- f"realistic skin texture with pores and fine hairs, fabric micro-details, "
342
- f"natural lighting with soft shadows, cinematic composition. "
343
- f"{sensuality}. Include {moment['accessories']} in scene. "
344
- f"--no explicit_content --style photographic --stylize 180"
345
- )
346
-
347
- self.history.append({
348
- "type": "moment",
349
- "ethnicity": ethnicity,
350
- "scene": moment_name,
351
- "nsfw": nsfw_mode,
352
- "prompt": prompt,
353
- "timestamp": datetime.datetime.now().isoformat()
354
- })
355
- return prompt
356
-
357
- def generate_batch_prompts(self, count: int, prompt_type: str, nsfw_mode: bool = False) -> List[str]:
358
  prompts = []
359
- for _ in range(count):
360
- ethnicity = random.choice(self.config.ETHNICITIES)
361
- if prompt_type == "roles":
362
- role = random.choice([r["role"] for r in self.config.PROFESSIONAL_ROLES])
363
- prompts.append(self.generate_role_prompt(ethnicity, role, nsfw_mode))
364
- else:
365
- moment = random.choice([m["scene"] for m in self.config.EVERYDAY_MOMENTS])
366
- prompts.append(self.generate_moment_prompt(ethnicity, moment, nsfw_mode))
 
 
 
 
 
 
 
367
  return prompts
368
 
369
- def get_history(self) -> List[Dict]:
370
- return self.history
371
-
372
- def clear_history(self) -> str:
373
- self.history = []
374
- return "History cleared"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
375
 
376
- # Crear instancia del generador
377
- generator = HyperRealisticPromptGenerator()
 
378
 
379
- # JavaScript para copiar al portapapeles
380
- copy_js = """
381
- function copyToClipboard(text) {
382
- navigator.clipboard.writeText(text).then(function() {
383
- console.log('Text copied to clipboard');
384
- }).catch(function(err) {
385
- console.error('Could not copy text: ', err);
386
- });
387
- }
388
  """
389
 
390
- def generate_batch_with_blocks(count, prompt_type, nsfw):
391
- prompts = generator.generate_batch_prompts(count, prompt_type, nsfw)
392
- blocks_html = ""
393
- for i, prompt in enumerate(prompts, 1):
394
- blocks_html += f"""
395
- <div class="prompt-block">
396
- <h4>📋 Prompt #{i}:</h4>
397
- <textarea style="width: 100%; height: 150px; padding: 10px; border: 1px solid #ddd; border-radius: 5px; font-family: monospace; margin-bottom: 10px;" readonly>{prompt}</textarea>
398
- <button class="copy-btn" onclick="copyToClipboard(`{prompt}`)">📋 Copy Prompt #{i}</button>
399
- </div>
400
- """
401
- return prompts, blocks_html
402
-
403
- def export_history():
404
- history = generator.get_history()
405
- if not history:
406
- return "No history to export"
407
-
408
- filename = f"prompt_history_{datetime.datetime.now().strftime('%Y%m%d_%H%M%S')}.json"
409
- with open(filename, 'w', encoding='utf-8') as f:
410
- json.dump(history, f, indent=2, ensure_ascii=False)
411
- return f"History exported to {filename}"
412
 
413
- # Interfaz Gradio
414
- with gr.Blocks(title="HyperRealistic Humanized Perfection Generator", theme=gr.themes.Soft(), css="""
415
- .prompt-block {
416
- border: 1px solid #e0e0e0;
417
- border-radius: 10px;
418
- padding: 15px;
419
- margin: 10px 0;
420
- background: white;
421
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
422
- }
423
- .copy-btn {
424
- background: #4CAF50;
425
- color: white;
426
- border: none;
427
- padding: 8px 16px;
428
- border-radius: 5px;
429
- cursor: pointer;
430
- margin-top: 10px;
431
- }
432
- .copy-btn:hover {
433
- background: #45a049;
434
- }
435
- .tab-content {
436
- padding: 20px;
437
- }
438
- .generated-prompt {
439
- font-family: monospace;
440
- background: #f8f9fa;
441
- padding: 15px;
442
- border-radius: 8px;
443
- border: 1px solid #e9ecef;
444
- margin: 10px 0;
445
- white-space: pre-wrap;
446
- word-wrap: break-word;
447
- }
448
- """) as demo:
449
-
450
- gr.Markdown("# 🌟 HyperRealistic Humanized Perfection Generator")
451
- gr.Markdown("Generate ultra-realistic humanized prompts with perfect lace details in 9:16 vertical format")
452
-
453
- # Inyectar JavaScript
454
- gr.HTML(f"<script>{copy_js}</script>")
455
-
456
- with gr.Tab("👔 Professional Roles"):
457
- with gr.Row():
458
- with gr.Column(scale=1):
459
- role_ethnicity = gr.Dropdown(
460
- choices=generator.config.ETHNICITIES,
461
- label="🎭 Ethnicity",
462
- value="Mediterranean",
463
- interactive=True
464
- )
465
- role_selection = gr.Dropdown(
466
- choices=[role["role"] for role in generator.config.PROFESSIONAL_ROLES],
467
- label="💼 Professional Role",
468
- value=generator.config.PROFESSIONAL_ROLES[0]["role"],
469
- interactive=True
470
- )
471
- role_nsfw = gr.Checkbox(
472
- label="🎨 Artistic NSFW Mode",
473
- value=False,
474
- info="Enable for more artistic sensuality"
475
- )
476
- generate_role_btn = gr.Button(
477
- "✨ Generate Role Prompt",
478
- variant="primary",
479
- size="lg"
480
- )
481
-
482
- with gr.Column(scale=2):
483
- role_output = gr.Textbox(
484
- label="📝 Generated Prompt",
485
- lines=6,
486
- max_lines=10,
487
- show_copy_button=True
488
- )
489
- role_prompt_block = gr.HTML(label="Prompt Block")
490
 
491
- generate_role_btn.click(
492
- fn=generator.generate_role_prompt,
493
- inputs=[role_ethnicity, role_selection, role_nsfw],
494
- outputs=[role_output]
495
- ).then(
496
- fn=lambda prompt: f"""
497
- <div class="prompt-block">
498
- <h4>📋 Prompt Ready to Copy:</h4>
499
- <div class="generated-prompt">{prompt}</div>
500
- <button class="copy-btn" onclick="copyToClipboard(`{prompt}`)">📋 Copy Prompt</button>
501
- </div>
502
- """,
503
- inputs=[role_output],
504
- outputs=[role_prompt_block]
505
- )
506
-
507
- with gr.Tab("🏠 Everyday Moments"):
508
  with gr.Row():
509
- with gr.Column(scale=1):
510
- moment_ethnicity = gr.Dropdown(
511
- choices=generator.config.ETHNICITIES,
512
- label="🎭 Ethnicity",
513
- value="Latin American",
514
- interactive=True
515
- )
516
- moment_selection = gr.Dropdown(
517
- choices=[moment["scene"] for moment in generator.config.EVERYDAY_MOMENTS],
518
- label="🌅 Daily Moment",
519
- value=generator.config.EVERYDAY_MOMENTS[0]["scene"],
520
- interactive=True
521
- )
522
- moment_nsfw = gr.Checkbox(
523
- label="🎨 Artistic NSFW Mode",
524
- value=False,
525
- info="Enable for more artistic sensuality"
526
- )
527
- generate_moment_btn = gr.Button(
528
- "✨ Generate Moment Prompt",
529
- variant="primary",
530
- size="lg"
531
- )
532
-
533
  with gr.Column(scale=2):
534
- moment_output = gr.Textbox(
535
- label="📝 Generated Prompt",
536
- lines=6,
537
- max_lines=10,
538
- show_copy_button=True
539
  )
540
- moment_prompt_block = gr.HTML(label="Prompt Block")
541
-
542
- generate_moment_btn.click(
543
- fn=generator.generate_moment_prompt,
544
- inputs=[moment_ethnicity, moment_selection, moment_nsfw],
545
- outputs=[moment_output]
546
- ).then(
547
- fn=lambda prompt: f"""
548
- <div class="prompt-block">
549
- <h4>📋 Prompt Ready to Copy:</h4>
550
- <div class="generated-prompt">{prompt}</div>
551
- <button class="copy-btn" onclick="copyToClipboard(`{prompt}`)">📋 Copy Prompt</button>
552
- </div>
553
- """,
554
- inputs=[moment_output],
555
- outputs=[moment_prompt_block]
556
- )
557
-
558
- with gr.Tab("🔄 Batch Generator"):
559
- with gr.Row():
560
- with gr.Column():
561
- batch_count = gr.Slider(
562
- minimum=1,
563
- maximum=10,
564
- value=3,
565
- step=1,
566
- label="Number of Prompts"
567
  )
568
- batch_type = gr.Radio(
569
- choices=["roles", "moments"],
570
- label="Prompt Type",
571
- value="roles",
572
- interactive=True
573
- )
574
- batch_nsfw = gr.Checkbox(
575
- label="🎨 Artistic NSFW Mode",
576
- value=False
577
- )
578
- generate_batch_btn = gr.Button(
579
- "🔄 Generate Batch",
580
- variant="primary"
581
- )
582
-
583
- with gr.Column():
584
- batch_output = gr.JSON(
585
- label="📦 Batch Prompts"
586
- )
587
- batch_prompt_blocks = gr.HTML(label="Batch Prompt Blocks")
588
 
589
- generate_batch_btn.click(
590
- fn=generate_batch_with_blocks,
591
- inputs=[batch_count, batch_type, batch_nsfw],
592
- outputs=[batch_output, batch_prompt_blocks]
593
- )
594
-
595
- with gr.Tab("📊 History & Export"):
596
  with gr.Row():
597
  with gr.Column():
598
- history_display = gr.JSON(
599
- label="📜 Prompt History",
600
- value=generator.get_history
601
- )
602
- clear_history_btn = gr.Button(
603
- "🗑️ Clear History",
604
- variant="secondary"
605
- )
606
-
607
- with gr.Column():
608
- export_btn = gr.Button(
609
- "💾 Export History as JSON",
610
- variant="primary"
611
- )
612
- export_status = gr.Textbox(
613
- label="Export Status",
614
- interactive=False
615
  )
 
 
616
 
617
- clear_history_btn.click(
618
- fn=generator.clear_history,
619
- outputs=[]
620
- ).then(
621
- fn=lambda: [],
622
- outputs=[history_display]
623
- ).then(
624
- fn=lambda: "History cleared",
625
- outputs=[export_status]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
626
  )
627
 
628
- export_btn.click(
629
- fn=export_history,
630
- outputs=[export_status]
631
- ).then(
632
- fn=generator.get_history,
633
- outputs=[history_display]
 
 
 
 
 
 
634
  )
635
-
636
- with gr.Tab("ℹ️ Instructions"):
637
- gr.Markdown("""
638
- ## 🎯 How to Use This Generator
639
-
640
- ### 🖼️ Hyper-Realistic Features:
641
- - **9:16 Vertical Format** - Perfect for mobile viewing
642
- - **Low-Angle Shots** - Strategic angles for intimate composition
643
- - **Ultra HD 16K** - Extreme detail and realism
644
- - **Humanized Perfection** - Natural skin textures and imperfections
645
-
646
- ### 🎨 Prompt Types:
647
- - **👔 Professional Roles**: 10 different professional scenarios
648
- - **🏠 Everyday Moments**: 10 natural, intimate situations
649
- - **🔄 Batch Generation**: Generate multiple prompts at once
650
-
651
- ### ⚙️ Settings:
652
- - **Ethnicity**: Choose from 11 diverse ethnic backgrounds
653
- - **NSFW Mode**: Toggle artistic sensuality levels
654
- - **Auto-Copy**: One-click copying from formatted blocks
655
-
656
- ### 📋 Copying Prompts:
657
- 1. Click the **"Generate"** button for your desired prompt type
658
- 2. Use the **"Copy Prompt"** button in the formatted block
659
- 3. Paste directly into your AI image generator
660
-
661
- ### 🎯 Perfect For:
662
- - Midjourney, Stable Diffusion, DALL-E
663
- - Professional photography simulations
664
- - Artistic and creative projects
665
- - Hyper-realistic character creation
666
-
667
- ### 📸 Technical Specifications:
668
- - **Format**: 9:16 Vertical
669
- - **Resolution**: 16K Ultra HD
670
- - **Angles**: Low-angle, intimate perspectives
671
- - **Lighting**: Professional studio and natural
672
- - **Details**: Skin pores, fabric textures, subsurface scattering
673
- """)
674
 
675
- # Launch the application
 
676
  if __name__ == "__main__":
677
- demo.launch(
678
- share=True,
679
- debug=True,
680
- show_error=True
681
- )
 
 
1
  import random
2
+ import gradio as gr
3
+ from data import fashion_elements, PhotoReal, negative_prompt_fusion
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
+ class FashionPromptGenerator:
6
  def __init__(self):
7
+ self.previous_prompts = set()
8
+ self.photo_real = PhotoReal()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
+ def generate_unique_prompts(self, subject_name, num_prompts=5):
11
+ """Genera una lista de prompts únicos."""
12
+ if not subject_name or subject_name.isspace():
13
+ subject_name = "a beautiful woman"
14
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  prompts = []
16
+ max_attempts = num_prompts * 10
17
+ attempts = 0
18
+
19
+ while len(prompts) < num_prompts and attempts < max_attempts:
20
+ prompt = self._build_fused_prompt(subject_name)
21
+ prompt_hash = hash(prompt)
22
+ if prompt_hash not in self.previous_prompts:
23
+ self.previous_prompts.add(prompt_hash)
24
+ prompts.append(prompt)
25
+ attempts += 1
26
+
27
+ # Si no se logran suficientes prompts únicos, rellena con algunos aleatorios (aunque se repitan)
28
+ while len(prompts) < num_prompts:
29
+ prompts.append(self._build_fused_prompt(subject_name))
30
+
31
  return prompts
32
 
33
+ def _build_fused_prompt(self, subject_name):
34
+ """Construye un prompt fusionando los estilos photorealistic y voyeuristic."""
35
+ # --- Elementos de Photorealistic ---
36
+ role = random.choice(self.photo_real.ROLES)
37
+ body = random.choice(self.photo_real.BODY)
38
+ skin = random.choice(self.photo_real.SKIN)
39
+ hair = random.choice(self.photo_real.HAIR)
40
+ expression = random.choice(self.photo_real.EXPRESSION)
41
+ sensual_pose = random.choice(self.photo_real.SENSUAL_POSES)
42
+
43
+ # --- Elementos de Voyeuristic ---
44
+ primary_color = random.choice(fashion_elements["colors"])
45
+ discovery_moment = random.choice(fashion_elements["discovery_moments"])
46
+ reveal_action = random.choice(fashion_elements["lingerie_reveal_actions"])
47
+ background = random.choice(fashion_elements["backgrounds"])
48
+ lighting = random.choice(fashion_elements["lighting"])
49
+
50
+ # --- Construcción del Prompt ---
51
+ prompt = (
52
+ f"Photorealistic portrait of {subject_name} as a {role['role']}, "
53
+ f"captured from an extreme low angle, floor-level perspective, shooting upward. "
54
+ f"The composition focuses on a moment of discovery, {discovery_moment}. "
55
+ f"She is {reveal_action}, creating a natural and unposed exposure.\n\n"
56
+ f"**Body & Appearance:**\n"
57
+ f"- **Physique:** {body} with {skin}.\n"
58
+ f"- **Hair:** {hair}.\n"
59
+ f"- **Expression:** {expression}.\n"
60
+ f"- **Outfit:** She wears {role['outfit']} over {primary_color} lingerie. "
61
+ f"Complemented by {self.photo_real.STOCKINGS} and {self.photo_real.HEELS}.\n\n"
62
+ f"**Scene & Atmosphere:**\n"
63
+ f"- **Setting:** {background} with {lighting}.\n"
64
+ f"- **Pose:** {sensual_pose['pose']} ({sensual_pose['view']} view), emphasizing a sensual and captivating stance.\n"
65
+ f"- **Mood:** Intimate, sensual, and elegantly composed.\n\n"
66
+ f"**Technical Details:**\n"
67
+ f"- **Camera:** {self.photo_real.CAMERA}.\n"
68
+ f"- **Quality:** Ultra HD, professional retouching, sharp focus on intimate details and facial expression.\n\n"
69
+ f"The image captures a fleeting, intimate moment that feels both spontaneous and beautifully composed, emphasizing the sensual discovery of hidden lingerie through natural movement and expert framing. "
70
+ f"--ar 9:16 --v 6 --q 2 --style raw --stylize 100"
71
+ )
72
+ return prompt.strip()
73
 
74
+ def clear_history(self):
75
+ """Limpia el historial de prompts generados."""
76
+ self.previous_prompts.clear()
77
 
78
+ custom_css = """
79
+ .prompt-box {
80
+ border: 1px solid #e2e8f0; border-radius: 8px; padding: 16px;
81
+ margin-bottom: 16px; background-color: #f8fafc;
82
+ font-family: 'Monaco', 'Consolas', monospace; font-size: 0.9em;
83
+ }
84
+ .prompt-title { font-weight: bold; margin-bottom: 8px; color: #4a5568; }
85
+ .header { text-align: center; margin-bottom: 20px; }
 
86
  """
87
 
88
+ def create_gradio_interface():
89
+ generator = FashionPromptGenerator()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
+ with gr.Blocks() as demo:
92
+ gr.Markdown("""
93
+ # 🎭 Advanced Fashion Prompt Generator
94
+ *Create photorealistic, discovery-focused prompts with a single, powerful style.*
95
+ """, elem_classes="header")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  with gr.Row():
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  with gr.Column(scale=2):
99
+ celebrity_input = gr.Textbox(
100
+ label="Celebrity Name (Optional)",
101
+ placeholder="Enter a name or leave blank for 'a beautiful woman'",
 
 
102
  )
103
+ num_prompts_slider = gr.Slider(
104
+ minimum=1, maximum=10, value=5, step=1, label="Number of Prompts to Generate"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  )
106
+ with gr.Column(scale=1):
107
+ generate_btn = gr.Button("✨ Generate Prompts", variant="primary")
108
+ clear_btn = gr.Button("🗑️ Clear History", variant="secondary")
109
+
110
+ gr.Markdown("---")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
 
 
 
 
 
 
 
 
112
  with gr.Row():
113
  with gr.Column():
114
+ gr.Markdown("### negativo Prompt")
115
+ negative_prompt_output = gr.Textbox(
116
+ value=negative_prompt_fusion,
117
+ label="",
118
+ lines=4,
119
+ interactive=False,
120
+ elem_classes="prompt-box"
 
 
 
 
 
 
 
 
 
 
121
  )
122
+
123
+ gr.Markdown("## Generated Prompts")
124
 
125
+ output_columns = []
126
+ output_prompts = []
127
+ for i in range(10):
128
+ with gr.Column(visible=False) as col:
129
+ gr.Markdown(f"### 🎯 Prompt {i+1}", elem_classes="prompt-title")
130
+ prompt_output = gr.Textbox(
131
+ label="", lines=10, interactive=False, elem_classes="prompt-box"
132
+ )
133
+ output_columns.append(col)
134
+ output_prompts.append(prompt_output)
135
+
136
+ def generate_and_display(celebrity_name, num_prompts):
137
+ num_prompts = int(num_prompts)
138
+ prompts = generator.generate_unique_prompts(celebrity_name, num_prompts)
139
+
140
+ updates = []
141
+ # Create a flat list of updates for all components
142
+ for i in range(10):
143
+ if i < num_prompts:
144
+ # Make column visible and set textbox value
145
+ updates.append(gr.update(visible=True))
146
+ updates.append(gr.update(value=prompts[i]))
147
+ else:
148
+ # Hide column and clear textbox value
149
+ updates.append(gr.update(visible=False))
150
+ updates.append(gr.update(value=""))
151
+
152
+ return updates
153
+
154
+ # The outputs list needs to be flattened
155
+ flat_outputs = [component for pair in zip(output_columns, output_prompts) for component in pair]
156
+
157
+ generate_btn.click(
158
+ fn=generate_and_display,
159
+ inputs=[celebrity_input, num_prompts_slider],
160
+ outputs=flat_outputs
161
  )
162
 
163
+ def clear_history_and_outputs():
164
+ generator.clear_history()
165
+ updates = []
166
+ for i in range(10):
167
+ updates.append(gr.update(visible=False)) # Hide column
168
+ updates.append(gr.update(value="")) # Clear textbox
169
+ return updates
170
+
171
+ clear_btn.click(
172
+ fn=clear_history_and_outputs,
173
+ inputs=None,
174
+ outputs=flat_outputs
175
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
 
177
+ return demo
178
+
179
  if __name__ == "__main__":
180
+ demo = create_gradio_interface()
181
+ demo.launch(share=True, css=custom_css)
182
+