Spaces:
Sleeping
Sleeping
File size: 9,630 Bytes
0cf2a52 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
# 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) |