Spaces:
Sleeping
Sleeping
| # app.py - Optimizado para Hugging Face Spaces | |
| import gradio as gr | |
| import random | |
| import json | |
| import datetime | |
| from typing import List, Dict | |
| # Configuración integrada (sin archivo separado para HF) | |
| class HyperRealisticConfig: | |
| ETHNICITIES = ["Latin American", "White American"] | |
| BODY_TYPES = [ | |
| "athletic slender", "voluptuous curves", "toned hourglass", | |
| "elegant tall", "feminine proportions" | |
| ] | |
| SKIN_DETAILS = [ | |
| "with hyper-realistic skin texture and natural glow", | |
| "showing perfect skin details and subtle highlights", | |
| "with realistic skin pores and natural complexion" | |
| ] | |
| LACE_BIKINI_STYLES = [ | |
| "delicate black lace bikini subtly visible through clothing", | |
| "sheer white lace underwear elegantly hinted", | |
| "burgundy silk lingerie delicately revealed" | |
| ] | |
| HOSIERY_STYLES = [ | |
| "black sheer thigh-high stockings with lace tops", | |
| "nude ultra-sheer thigh-high stockings", | |
| "black back-seam thigh-high stockings" | |
| ] | |
| HEEL_STYLES = [ | |
| "black patent leather stilettos with elegant arch", | |
| "nude pointed-toe high heels", | |
| "black suede stilettos with slender heel" | |
| ] | |
| HAIRSTYLES = [ | |
| "long flowing wavy hair with perfect styling", | |
| "sleek long straight hair with elegant movement", | |
| "long layered hair with soft curls and volume" | |
| ] | |
| MAKEUP_STYLES = [ | |
| "flawless natural makeup with perfect complexion", | |
| "elegant glam makeup with defined features", | |
| "perfect natural makeup with subtle enhancement" | |
| ] | |
| PROFESSIONAL_ROLES = ( | |
| "Executive Secretary", "Luxury Hotel Manager", "Fashion Boutique Manager", | |
| "Corporate Lawyer", "Private Jet Attendant", "Art Gallery Curator", | |
| "University Professor", "Wine Sommelier", "Ballet Instructor", | |
| "Yacht Stewardess", "Casino Dealer", "News Anchor", "Elegant Maid", | |
| "Flight Attendant", "Police Officer", "Military Officer", "Nurse", | |
| "Fitness Instructor", "Yoga Practitioner", "Salsa Dancer", | |
| "Telenovela Actress", "Latin Chef", "Fiesta Organizer" | |
| ) | |
| EVERYDAY_MOMENTS = ( | |
| {"scene": "Cocina matutina", "action": "agachándose a sacar algo del horno bajo", "outfit": "elegante atuendo casual con medias hasta los muslos", "setting": "cocina soleada", "accessories": "taza de café"}, | |
| {"scene": "Lavandería", "action": "doblándose para sacar ropa de la secadora", "outfit": "ropa elegante con medias thigh-high", "setting": "cuarto de lavado", "accessories": "cesta de ropa"}, | |
| {"scene": "Jardinería", "action": "arrodillada plantando flores", "outfit": "vestido con medias largas", "setting": "jardín trasero", "accessories": "guantes de jardinería"}, | |
| {"scene": "Yoga en casa", "action": "haciendo postura elegante con medias", "outfit": "atuendo de yoga con medias", "setting": "sala con esterilla", "accessories": "bloque de yoga"} | |
| ) | |
| # Generator Class | |
| class HyperRealisticPromptGenerator: | |
| def __init__(self): | |
| self.config = HyperRealisticConfig() | |
| self.history = [] | |
| def _random_style_components(self): | |
| cfg = self.config | |
| return { | |
| "body": random.choice(cfg.BODY_TYPES), | |
| "skin": random.choice(cfg.SKIN_DETAILS), | |
| "lingerie": random.choice(cfg.LACE_BIKINI_STYLES), | |
| "hosiery": random.choice(cfg.HOSIERY_STYLES), | |
| "heels": random.choice(cfg.HEEL_STYLES), | |
| "hair": random.choice(cfg.HAIRSTYLES), | |
| "makeup": random.choice(cfg.MAKEUP_STYLES), | |
| } | |
| def generate_role_prompt(self, ethnicity, role_name): | |
| s = self._random_style_components() | |
| prompt = ( | |
| f"ULTRA-REALISTIC FULL FRAME PORTRAIT, 9:16 VERTICAL, CINEMATIC HYPER-DETAILED PHOTOGRAPHY, " | |
| f"{ethnicity} {role_name}, {s['body']} {s['skin']}, " | |
| f"WEARING ELEGANT PROFESSIONAL ATTIRE WITH {s['hosiery'].upper()} AND {s['heels'].upper()}, " | |
| f"LONG ELEGANT HAIRSTYLE: {s['hair']}, FLAWLESS MAKEUP: {s['makeup']}, " | |
| f"SUBTLY REVEALING {s['lingerie'].upper()} THROUGH CLOTHING AS IF UNINTENTIONALLY SEEN, " | |
| f"CAUGHT IN AN ELEGANT SPONTANEOUS MOMENT, PERFECTLY FRAMED TO FILL THE ENTIRE COMPOSITION, " | |
| f"SOFT CINEMATIC LIGHTING, PROFESSIONAL STUDIO PORTRAIT, " | |
| f"MAXIMUM DETAIL, HUMANIZED PERFECTION, NATURAL YET ELEGANT EXPRESSION, " | |
| f"ARTISTIC SENSUALITY, TASTEFUL REVELATION, CANDID ELEGANCE " | |
| f"--ar 9:16 --style raw --quality 2 --stylize 750" | |
| ) | |
| self.history.append({ | |
| "type": "role", "role": role_name, "ethnicity": ethnicity, | |
| "prompt": prompt, "timestamp": datetime.datetime.now().isoformat() | |
| }) | |
| return prompt | |
| def generate_moment_prompt(self, ethnicity, moment): | |
| s = self._random_style_components() | |
| prompt = ( | |
| f"HYPER-REALISTIC CANDID PHOTOGRAPH, 9:16 VERTICAL, FULL FRAME COMPOSITION, " | |
| f"{ethnicity} WOMAN, {s['body']} FIGURE {s['skin']}, " | |
| f"WEARING {moment['outfit']} WITH {s['hosiery'].upper()} AND {s['heels'].upper()}, " | |
| f"LONG ELEGANT HAIR: {s['hair']}, PERFECT MAKEUP: {s['makeup']}, " | |
| f"SUBTLY SHOWING {s['lingerie'].upper()} AS IF ACCIDENTALLY REVEALED, " | |
| f"CAPTURED WHILE: {moment['action']} IN {moment['setting']}, " | |
| f"SPONTANEOUS ELEGANT POSE, COMPLETELY FILLING THE FRAME, " | |
| f"SOFT PROFESSIONAL LIGHTING, ULTRA-DETAILED, HUMANIZED PERFECTION " | |
| f"--ar 9:16 --style raw --quality 2 --stylize 750" | |
| ) | |
| self.history.append({ | |
| "type": "moment", "scene": moment['scene'], "ethnicity": ethnicity, | |
| "prompt": prompt, "timestamp": datetime.datetime.now().isoformat() | |
| }) | |
| return prompt | |
| # Initialize generator | |
| generator = HyperRealisticPromptGenerator() | |
| # Create the Gradio interface | |
| with gr.Blocks( | |
| title="Elegant Prompt Generator", | |
| theme=gr.themes.Soft(primary_hue="red", secondary_hue="pink"), | |
| css=""".gradio-container {background: linear-gradient(135deg, #fef2f2 0%, #ffe4e6 100%);}""" | |
| ) as demo: | |
| gr.Markdown("# 🌹 Elegant HyperRealistic Prompt Generator") | |
| gr.Markdown("Generate ultra-realistic prompts with elegant styling for AI image generation") | |
| with gr.Tab("👔 Professional Roles"): | |
| with gr.Row(): | |
| with gr.Column(): | |
| ethnicity = gr.Dropdown( | |
| choices=generator.config.ETHNICITIES, | |
| value="Latin American", | |
| label="Ethnicity" | |
| ) | |
| role = gr.Dropdown( | |
| choices=generator.config.PROFESSIONAL_ROLES, | |
| value=generator.config.PROFESSIONAL_ROLES[0], | |
| label="Professional Role" | |
| ) | |
| generate_btn = gr.Button("Generate Prompt", variant="primary") | |
| with gr.Column(): | |
| output = gr.Textbox( | |
| label="Generated Prompt", | |
| lines=8, | |
| max_lines=12, | |
| show_copy_button=True | |
| ) | |
| generate_btn.click( | |
| fn=generator.generate_role_prompt, | |
| inputs=[ethnicity, role], | |
| outputs=output | |
| ) | |
| with gr.Tab("🏠 Everyday Moments"): | |
| with gr.Row(): | |
| with gr.Column(): | |
| ethnicity_m = gr.Dropdown( | |
| choices=generator.config.ETHNICITIES, | |
| value="Latin American", | |
| label="Ethnicity" | |
| ) | |
| moments_list = [m["scene"] for m in generator.config.EVERYDAY_MOMENTS] | |
| moment = gr.Dropdown( | |
| choices=moments_list, | |
| value=moments_list[0], | |
| label="Everyday Moment" | |
| ) | |
| generate_moment_btn = gr.Button("Generate Moment Prompt", variant="primary") | |
| with gr.Column(): | |
| output_m = gr.Textbox( | |
| label="Generated Prompt", | |
| lines=8, | |
| max_lines=12, | |
| show_copy_button=True | |
| ) | |
| def get_moment_prompt(eth, scene_name): | |
| moment = next(m for m in generator.config.EVERYDAY_MOMENTS if m["scene"] == scene_name) | |
| return generator.generate_moment_prompt(eth, moment) | |
| generate_moment_btn.click( | |
| fn=get_moment_prompt, | |
| inputs=[ethnicity_m, moment], | |
| outputs=output_m | |
| ) | |
| with gr.Tab("ℹ️ About"): | |
| gr.Markdown(""" | |
| ## About This Generator | |
| This tool creates hyper-realistic prompts for AI image generation with consistent elegant styling: | |
| **🎯 Always Includes:** | |
| - Thigh-high stockings | |
| - High heels | |
| - Long elegant hair | |
| - Perfect makeup | |
| - Subtle lace reveals | |
| - 9:16 vertical format | |
| - Full frame composition | |
| **🖼️ Perfect for:** | |
| - Midjourney | |
| - Stable Diffusion | |
| - DALL-E 3 | |
| - Other AI image generators | |
| **⚡ Features:** | |
| - Instant generation | |
| - One-click copy | |
| - Professional styling | |
| - Artistic sensuality | |
| """) | |
| # Para Hugging Face Spaces | |
| if __name__ == "__main__": | |
| demo.launch(debug=True, share=True) |