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
|
| 12 |
-
Args:
|
| 13 |
-
name (str): El nombre del usuario. Si está vacío, se usa 'world'.
|
| 14 |
-
intensity (float): Un valor para determinar cuántos signos de exclamación añadir.
|
| 15 |
-
|
| 16 |
-
Returns:
|
| 17 |
-
str: La cadena de saludo completa.
|
| 18 |
"""
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
)
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# app.py
|
| 2 |
import gradio as gr
|
| 3 |
+
#!/usr/bin/env python3
|
| 4 |
+
# -*- coding: utf-8 -*-
|
| 5 |
|
| 6 |
+
"""
|
| 7 |
+
BATUTO-bot (refined version)
|
| 8 |
+
|
| 9 |
+
This script generates prompts for professional color photographs capturing a famous and beautiful celebrity in a provocative yet elegant moment, with subtle hints of lace bikini-style thong lingerie during an everyday activity. The focus is on seduction, natural poses, and professional studio photography.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import secrets
|
| 13 |
+
import datetime
|
| 14 |
+
from enum import Enum
|
| 15 |
+
from dataclasses import dataclass
|
| 16 |
+
from typing import List, Dict, Any, Optional
|
| 17 |
+
|
| 18 |
+
import gradio as gr
|
| 19 |
+
|
| 20 |
+
# ----------------------------------------------------------------------
|
| 21 |
+
# -------------------------- ENUMS & DATACLASSES -----------------------
|
| 22 |
+
# ----------------------------------------------------------------------
|
| 23 |
+
class ColorPalette(Enum):
|
| 24 |
+
SCARLET_RED = "#FF2400"
|
| 25 |
+
PEARL_WHITE = "#FFFFFF"
|
| 26 |
+
MIDNIGHT_BLUE = "#082567"
|
| 27 |
+
|
| 28 |
+
@classmethod
|
| 29 |
+
def random_color(cls, exclude: List[str] = None) -> str:
|
| 30 |
+
colors = list(cls)
|
| 31 |
+
if exclude:
|
| 32 |
+
colors = [c for c in colors if c.name not in exclude]
|
| 33 |
+
choice = secrets.choice(colors)
|
| 34 |
+
return f"{choice.name.replace('_', ' ').title()} ({choice.value})"
|
| 35 |
+
|
| 36 |
+
@dataclass
|
| 37 |
+
class LingerieDesign:
|
| 38 |
+
name: str
|
| 39 |
+
color: str
|
| 40 |
+
bra: str
|
| 41 |
+
thong: str
|
| 42 |
+
stockings: str
|
| 43 |
+
garter: Optional[str]
|
| 44 |
+
|
| 45 |
+
class LingerieDesigns:
|
| 46 |
+
BASE_DESIGNS: List[LingerieDesign] = [
|
| 47 |
+
LingerieDesign(
|
| 48 |
+
"Delicate Elegance",
|
| 49 |
+
"Pearl White",
|
| 50 |
+
"light, transparent lace bra with subtle floral embroidery",
|
| 51 |
+
"lace bikini-style thong with delicate transparencies and intricate details",
|
| 52 |
+
"thigh-high lace stockings with fine floral patterns",
|
| 53 |
+
"delicate adjustable garter belt with satin accents",
|
| 54 |
+
),
|
| 55 |
+
LingerieDesign(
|
| 56 |
+
"Midnight Seduction",
|
| 57 |
+
"Midnight Blue",
|
| 58 |
+
"semi-sheer lace bra with elegant scalloped edges",
|
| 59 |
+
"lace bikini-style thong with sensual transparencies and high-cut design",
|
| 60 |
+
"thigh-high lace stockings with subtle geometric lace patterns",
|
| 61 |
+
None,
|
| 62 |
+
),
|
| 63 |
+
]
|
| 64 |
+
|
| 65 |
+
@classmethod
|
| 66 |
+
def random_base_design(cls) -> LingerieDesign:
|
| 67 |
+
return secrets.choice(cls.BASE_DESIGNS)
|
| 68 |
+
|
| 69 |
+
class CameraAngles(Enum):
|
| 70 |
+
FRONTAL_SUBTLE = ("Frontal Subtle", "A strategic frontal angle capturing the figure naturally")
|
| 71 |
+
SIDE_PROFILE = ("Side Profile", "A soft side angle emphasizing curves and textures")
|
| 72 |
+
THREE_QUARTER = ("Three-Quarter", "A 45° angle highlighting elegance and movement")
|
| 73 |
+
|
| 74 |
+
@classmethod
|
| 75 |
+
def random_angle(cls):
|
| 76 |
+
return secrets.choice(list(cls))
|
| 77 |
+
|
| 78 |
+
class StyleElements:
|
| 79 |
+
HAIR = ["long, glossy loose waves with elegant dye", "sleek updo with soft curls", "flowing layered hair with natural shine"]
|
| 80 |
+
EVERYDAY_ACTIVITIES = [
|
| 81 |
+
"adjusting a silk scarf in a luxurious penthouse",
|
| 82 |
+
"sipping coffee in a Parisian loft with golden sunlight",
|
| 83 |
+
"reaching for a book in an intimate library setting",
|
| 84 |
+
]
|
| 85 |
+
OUTERWEAR = [
|
| 86 |
+
"a semi-sheer silk blouse with delicate buttons",
|
| 87 |
+
"a flowing chiffon dress with a subtle slit",
|
| 88 |
+
"a tailored blazer with a plunging neckline",
|
| 89 |
+
]
|
| 90 |
+
|
| 91 |
+
@classmethod
|
| 92 |
+
def random_style(cls) -> Dict[str, str]:
|
| 93 |
+
return {
|
| 94 |
+
"hair": secrets.choice(cls.HAIR),
|
| 95 |
+
"activity": secrets.choice(cls.EVERYDAY_ACTIVITIES),
|
| 96 |
+
"outerwear": secrets.choice(cls.OUTERWEAR),
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
# ----------------------------------------------------------------------
|
| 100 |
+
# --------------------- PROMPT BUILDERS --------------------------------
|
| 101 |
+
# ----------------------------------------------------------------------
|
| 102 |
+
def build_prompt_professional(
|
| 103 |
+
model_name: str,
|
| 104 |
+
design: LingerieDesign,
|
| 105 |
+
style: Dict[str, str],
|
| 106 |
+
angle: CameraAngles,
|
| 107 |
+
) -> str:
|
| 108 |
+
intros = [
|
| 109 |
+
f"{model_name}, a famous and beautiful celebrity, captured in a provocative yet elegant moment.",
|
| 110 |
+
f"{model_name} exudes seduction in a natural, everyday scene, with subtle hints of luxury.",
|
| 111 |
+
f"A stunning {model_name} in a professional photoshoot, radiating desire and elegance.",
|
| 112 |
+
]
|
| 113 |
+
intro = secrets.choice(intros)
|
| 114 |
+
|
| 115 |
+
hair_activity = f"Her hair styled in {style['hair']}, while {style['activity']}."
|
| 116 |
+
outerwear = f"She wears {style['outerwear']}, which subtly reveals hints of her {design.thong} through a natural movement."
|
| 117 |
+
lingerie_details = (
|
| 118 |
+
f"The lingerie set includes {design.bra}, {design.thong} with sensual lace transparencies, "
|
| 119 |
+
f"and {design.stockings}. {design.garter if design.garter else ''}"
|
| 120 |
+
)
|
| 121 |
+
angle_text = f"Captured from a {angle.value[0].lower()} angle, emphasizing the texture and details of the lace."
|
| 122 |
+
photography_specs = (
|
| 123 |
+
"Ultra HD 16K (15360x8640) RAW photo, shot with Canon EOS R5 Cine RAW, Canon RF 85mm f/1.2L USM lens. "
|
| 124 |
+
"Lit by ARRI SkyPanel S360-C, with perfect depth of field and no shadows. "
|
| 125 |
+
"Color graded in DaVinci Resolve for flawless skin and fabric textures. "
|
| 126 |
+
"Signed 'BATUTO-ART' in the lower right corner (3% of image size)."
|
| 127 |
+
)
|
| 128 |
+
visual_rules = (
|
| 129 |
+
"The frame is fully occupied by her figure, with no distracting edges or designs. "
|
| 130 |
+
"Professional lighting highlights skin and lace textures without overexposure, "
|
| 131 |
+
"focusing precisely on the area where the thong is subtly hinted at. "
|
| 132 |
+
"She gazes at the viewer with desire, her gestures exuding seduction in a natural pose."
|
| 133 |
+
)
|
| 134 |
+
|
| 135 |
+
return f"{intro} {hair_activity} {outerwear} {lingerie_details} {angle_text} {photography_specs} {visual_rules}"
|
| 136 |
+
|
| 137 |
+
def build_multiple_scenes_professional(model_name: str, count: int = 3) -> List[str]:
|
| 138 |
+
return [
|
| 139 |
+
build_prompt_professional(
|
| 140 |
+
model_name,
|
| 141 |
+
LingerieDesigns.random_base_design(),
|
| 142 |
+
StyleElements.random_style(),
|
| 143 |
+
CameraAngles.random_angle(),
|
| 144 |
+
)
|
| 145 |
+
for _ in range(count)
|
| 146 |
+
]
|
| 147 |
+
|
| 148 |
+
# ----------------------------------------------------------------------
|
| 149 |
+
# --------------------- GRADIO LOGIC (simplified) ----------------------
|
| 150 |
+
# ----------------------------------------------------------------------
|
| 151 |
+
def generate_and_display_prompts(model_name: str, num_prompts: int):
|
| 152 |
"""
|
| 153 |
+
Callback used by the Gradio button.
|
| 154 |
+
Generates 'num_prompts' prompts and returns a Markdown with the results.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
"""
|
| 156 |
+
try:
|
| 157 |
+
if not model_name or not model_name.strip():
|
| 158 |
+
return "⚠️ Please enter a valid model name."
|
| 159 |
+
|
| 160 |
+
num = int(round(num_prompts))
|
| 161 |
+
prompts = build_multiple_scenes_professional(model_name, num)
|
| 162 |
+
|
| 163 |
+
output_md = ""
|
| 164 |
+
for idx, prmpt in enumerate(prompts, start=1):
|
| 165 |
+
output_md += (
|
| 166 |
+
f"### Prompt {idx}\n"
|
| 167 |
+
f"```\n{prmpt}\n```\n\n"
|
| 168 |
+
"---\n"
|
| 169 |
+
)
|
| 170 |
+
return output_md
|
| 171 |
+
except Exception as exc:
|
| 172 |
+
return f"❌ Unexpected error: {exc}"
|
| 173 |
+
|
| 174 |
+
# ----------------------------------------------------------------------
|
| 175 |
+
# --------------------- GRADIO INTERFACE -------------------------------
|
| 176 |
+
# ----------------------------------------------------------------------
|
| 177 |
+
with gr.Blocks(title="BATUTO-bot") as demo:
|
| 178 |
+
gr.Markdown("# BATUTO-bot")
|
| 179 |
+
gr.Markdown("Generates AI prompts for professional, seductive photoshoot images with subtle lingerie hints.")
|
| 180 |
+
|
| 181 |
+
with gr.Row():
|
| 182 |
+
model_name_input = gr.Textbox(
|
| 183 |
+
label="Model Name",
|
| 184 |
+
placeholder="E.g., Ariana Grande",
|
| 185 |
+
lines=1,
|
| 186 |
+
)
|
| 187 |
+
num_prompts_input = gr.Slider(
|
| 188 |
+
minimum=1,
|
| 189 |
+
maximum=5,
|
| 190 |
+
value=3,
|
| 191 |
+
step=1,
|
| 192 |
+
label="Number of Prompts to Generate",
|
| 193 |
+
)
|
| 194 |
+
|
| 195 |
+
generate_button = gr.Button("Generate Prompts")
|
| 196 |
+
gr.Markdown("## Generated Prompts")
|
| 197 |
+
output_container = gr.Markdown()
|
| 198 |
+
|
| 199 |
+
generate_button.click(
|
| 200 |
+
fn=generate_and_display_prompts,
|
| 201 |
+
inputs=[model_name_input, num_prompts_input],
|
| 202 |
+
outputs=output_container,
|
| 203 |
+
)
|
| 204 |
+
|
| 205 |
+
# Permite que la llamada a la API no bloquee la UI
|
| 206 |
+
demo.queue()
|
| 207 |
+
|
| 208 |
+
if __name__ == "__main__":
|
| 209 |
+
demo.launch()
|