import random import gradio as gr from typing import Optional, Dict, Any, List class PromptGenerator: def __init__(self): self.ROLES = [ "nurse", "nun", "doctor", "secretary", "teacher", "schoolgirl", "lawyer", "yoga instructor", "policewoman", "female military officer in gala uniform", "WWII-era secretary", "1960s flight attendant", "boudoir model", "elegant judge", "seductive librarian", "sensual model", "alluring secretary", "elegant flight attendant", "seductive maid", "mysterious nurse", "captivating schoolgirl", "business executive", "fitness model" ] self.HAIR_COLORS = [ "deep sapphire blue", "silver platinum", "vibrant ruby red", "glossy jet black", "luxurious chestnut brown", "emerald green", "vivid amethyst purple", "chocolate brown", "honey blonde", "burgundy red" ] self.EYE_COLORS = [ "intense brown", "bright sapphire blue", "emerald green", "golden amber", "fascinating hazel", "deep violet", "piercing emerald", "deep sapphire", "intense amber", "hypnotic hazel", "vibrant violet", "mysterious gray" ] self.HAIR_STYLES = [ "long flowing chestnut hair styled in soft waves", "sleek straight long black hair", "luxurious long blonde curls", "elegant updo with loose cascading strands", "glossy long brunette hair parted in the middle", "long flowing waves", "luxurious straight hair", "voluminous curls", "elegant updo with cascading strands", "thick braid over the shoulder", "loose and silky layers", "messy chic bun" ] self.OUTFIT_TEMPLATES = { "nurse": "a classic short nurse dress, thigh-high stockings, semi-transparent lace panties subtly slipping down as if accidentally revealed beneath a skirt, no bra, elegant high heels", "nun": "a sensual interpretation of a nun's habit with a revealing long robe and thigh-high stockings, semi-transparent lace panties suggesting a playful accidental reveal, no bra, black stiletto heels", "doctor": "a daring white lab coat minidress left slightly open, thigh-high stockings, semi-transparent lace panties exposed subtly as if by chance, no bra, high heels", "secretary": "a provocative office pencil skirt and sheer blouse, thigh-high stockings, semi-transparent lace panties hinted at from a natural skirt shift, no bra, red high heels", "teacher": "a fitted blazer over a silk blouse and short skirt, thigh-high stockings, delicate lace panties subtly visible during natural movement, no bra, classic pumps", "schoolgirl": "a short pleated skirt and white blouse, thigh-high stockings, classic black lace panties slipping into view during casual poses, no bra, black loafers", "lawyer": "a tailored suit with skirt cut above knees, silk blouse unbuttoned slightly, thigh-high stockings, lace panties revealed subtly when seated, no bra, leather pumps", "yoga instructor": "form-fitting athletic wear that hugs curves, moisture-wicking fabric, lace panty lines subtly visible through tight clothing, sports bra barely containing", "policewoman": "a fitted police uniform with short skirt, thigh-high stockings, lace panties subtly showing during action poses, no bra, polished combat boots", "female military officer in gala uniform": "a ceremonial uniform with decorative elements, thigh-high stockings, lace panties hinted beneath tailored skirt, no bra, dress shoes", "WWII-era secretary": "vintage styled dress with seamed stockings, lace panties from era subtly revealed when bending, no bra, period-appropriate heels", "1960s flight attendant": "retro uniform with pillbox hat, thigh-high stockings, vintage lace panties subtly visible during graceful movements, no bra, classic heels", "boudoir model": "silk robe falling open, thigh-high stockings, intricate lace panties prominently displayed, no bra, feathered mules", "elegant judge": "judicial robes over a sophisticated dress, thigh-high stockings, luxury lace panties subtly revealed when robes part, no bra, court heels", "seductive librarian": "tight sweater and pencil skirt, thigh-high stockings, lace panties subtly visible when reaching for books, no bra, reading glasses", "sensual model": "designer evening gown with thigh slit, thigh-high stockings, luxury lace panties showcased during photo shoot poses, no bra, runway heels", "alluring secretary": "bodycon dress and blazer, thigh-high stockings, lace panties clearly outlined beneath fabric, no bra, stiletto pumps", "elegant flight attendant": "modern uniform with scarf, thigh-high stockings, lace panties subtly visible during boarding gestures, no bra, airline heels", "seductive maid": "traditional french maid costume shortened, thigh-high stockings, lace panties prominently displayed during cleaning poses, no bra, mary janes", "mysterious nurse": "night shift uniform with cape, thigh-high stockings, lace panties revealed during urgent movements, no bra, silent shoes", "captivating schoolgirl": "a short skirt and blouse with thigh-high stockings, classic black lace panties slipping into view, no bra, black patent heels", "business executive": "power suit with mini skirt, thigh-high stockings, luxury lace panties visible during confident walking, no bra, executive heels", "fitness model": "performance activewear, thigh-high athletic socks, sporty lace panties outlined during exercise poses, no bra, training shoes" } self.POSES = [ "standing gracefully with one leg slightly forward, skirt adjusting as if caught in motion revealing lace panties", "seated on the edge, legs crossed, skirt shifting and lace panties subtly visible", "bending forward slightly as if picking something up, skirt rising to show lace panties", "leaning against a wall, one hip cocked, skirt riding up to reveal lace panties", "walking with a natural sway, skirt moving with motion to show glimpses of lace panties", "reaching upwards for an object, skirt lifting to display lace panties", "sitting on stairs, legs slightly apart, skirt providing a view of lace panties", "lying on a sofa, dress falling open to reveal lace panties naturally", "dancing gently, skirt flowing to show lace panties during spins", "adjusting stockings, skirt lifted to expose lace panties momentarily" ] self.SETTINGS = [ "a modern professional office, golden sunset light and sophisticated decor", "a stylish hospital room, clean bright tones, realistic medical equipment", "a luxurious bedroom with silk sheets and soft lighting", "an elegant living room with vintage furniture and warm ambiance", "a photography studio with professional lighting and minimalist backdrop", "a high-end hotel suite with city views and contemporary design", "a classic library with wooden shelves and warm reading lights", "a rooftop terrace with urban landscape and twilight sky", "a dressing room with large mirrors and velvet furnishings", "a boutique hotel lobby with art deco elements and soft lighting" ] self.ATMOSPHERES = [ "soft professional lighting with perfect color, crisp highlights and smooth skin shadows", "warm ambient sunlight, rich gold reflections and depth", "moody cinematic lighting with dramatic shadows and highlights", "romantic candlelight with soft glows and intimate shadows", "studio flash lighting with clean, sharp details and minimal shadows", "golden hour natural light with warm, flattering tones", "moonlit ambiance with cool tones and mysterious atmosphere", "neon accent lighting with vibrant colors and urban vibe" ] self.TECHNICAL_DETAILS = ( "captured with varied angles including low-angle views from knees upwards to head filling the full vertical 9:16 frame, " "showcasing close-up ultra-high definition fabric, lace, skin, and hair detail, perfect makeup, anatomical perfection, elegant high heels, NO bra. " "Humanized professional photorealism: Canon R5, 85mm lens, f/1.2, 16K resolution, flawless skin pores, hyper-real lace and wardrobe texture, natural human imperfections. " "Exclude: cartoon, 2D, painting, stylized, CGI, illustration, lowres, watermark." ) def _random_choice(self, lst): return random.choice(lst) def generate_prompt(self, seed: Optional[Dict[str, Any]] = None) -> str: seed = seed or {} role = seed.get("role", self._random_choice(self.ROLES)) hair_style = seed.get("hair_style", self._random_choice(self.HAIR_STYLES)) eye_color = seed.get("eye_color", self._random_choice(self.EYE_COLORS)) outfit = self.OUTFIT_TEMPLATES.get(role, self.OUTFIT_TEMPLATES["secretary"]) pose = seed.get("pose", self._random_choice(self.POSES)) setting = seed.get("setting", self._random_choice(self.SETTINGS)) atmosphere = seed.get("atmosphere", self._random_choice(self.ATMOSPHERES)) prompt = ( f"A hyperrealistic full-body portrait of a sensual {role} with {hair_style} in {eye_color} eyes, " f"perfect makeup, flawless skin with subtle natural imperfections. Wearing {outfit}. " f"Pose: {pose}. Scene: {setting}. Atmosphere: {atmosphere}. " f"{self.TECHNICAL_DETAILS}" ) return prompt def generate_five_prompts(self) -> List[str]: return [self.generate_prompt() for _ in range(5)] # --- Función de la interfaz de usuario de Gradio --- def generate_prompts_list(): """Genera y devuelve la lista de 5 prompts.""" generator = PromptGenerator() return generator.generate_five_prompts() # --- Definición de la interfaz de usuario con Acordeones --- PROMPT_COUNT = 5 # Cantidad de prompts a generar with gr.Blocks() as demo: gr.Markdown("# Hyperrealistic Full-Body Prompt Generator") # Crea una lista de Textbox para mostrar cada prompt individualmente prompt_outputs = [gr.Textbox(label=f"Prompt {i+1}", lines=5, interactive=False, show_copy_button=True) for i in range(PROMPT_COUNT)] button = gr.Button("Generate 5 Prompts") # Define el layout con acordeones with gr.Row(): with gr.Column(): gr.Markdown("## Generated Prompts") # Itera para crear 5 acordeones for i in range(PROMPT_COUNT): with gr.Accordion(f"Prompt #{i+1} (Click para ver y copiar)", open=False): # Simplemente referencia el Textbox, sin llamar a .render() prompt_outputs[i] # La acción del botón: llama a la función de generación y asigna la lista de resultados button.click( fn=generate_prompts_list, outputs=prompt_outputs ) if __name__ == "__main__": demo.launch()