BATUTO-ART commited on
Commit
f1d6136
·
verified ·
1 Parent(s): b1e661f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +312 -327
app.py CHANGED
@@ -1,27 +1,12 @@
1
  import gradio as gr
2
  import random
3
  import os
4
- import requests
5
- from PIL import Image
6
- from io import BytesIO
7
- import concurrent.futures
8
- import threading
9
- from openai import OpenAI
10
- import subprocess # Added this line
11
- import sys # Added this line for sys.executable
12
 
13
  # ============================================
14
- # CONFIGURACIONES Y DATOS
15
  # ============================================
16
 
17
- # Configuración de APIs
18
- SAMBANOVA_API_KEY = os.getenv("SAMBANOVA_API_KEY")
19
- client_sambanova = OpenAI(
20
- api_key=SAMBANOVA_API_KEY,
21
- base_url="https://api.sambanova.ai/v1"
22
- ) if SAMBANOVA_API_KEY else None
23
-
24
- # Datos para el generador automático de prompts
25
  LINGERIE_VARIATIONS = [
26
  "matching fiery red lace bra and thong set with thigh-high stockings",
27
  "sheer midnight black lingerie ensemble with transparent lace bra",
@@ -72,123 +57,28 @@ PROFESSIONAL_ROLES = [
72
  ]
73
 
74
  # ============================================
75
- # FUNCIONES REVE CREATE
76
- # ============================================
77
-
78
- def generate_single_reve_image(prompt, key, model, index, results_list, lock):
79
- """Genera una sola imagen usando REVE API"""
80
- try:
81
- url = "https://api.reveai.xyz/v1/images"
82
- headers = {"Authorization": f"Bearer {key}"}
83
- data = {"prompt": prompt, "model": model}
84
- resp = requests.post(url, json=data, headers=headers, timeout=30)
85
-
86
- if resp.status_code != 200:
87
- return
88
-
89
- img_url = resp.json().get("image")
90
- if not img_url:
91
- return
92
-
93
- img_data = requests.get(img_url, timeout=30).content
94
- img = Image.open(BytesIO(img_data))
95
- out = f"/tmp/reve_{index}_{threading.current_thread().ident}.png"
96
- img.save(out)
97
-
98
- with lock:
99
- results_list.append(out)
100
- except Exception as e:
101
- print(f"Error generando imagen: {e}")
102
-
103
- def reve_generate_multiple(prompt, key, model, num_images):
104
- """Genera múltiples imágenes en paralelo"""
105
- if not key:
106
- return None
107
-
108
- num_images = min(int(num_images), 8)
109
- results = []
110
- lock = threading.Lock()
111
-
112
- with concurrent.futures.ThreadPoolExecutor(max_workers=min(num_images, 4)) as executor:
113
- futures = [
114
- executor.submit(
115
- generate_single_reve_image,
116
- prompt, key, model, i, results, lock
117
- ) for i in range(num_images)
118
- ]
119
- concurrent.futures.wait(futures)
120
-
121
- return results if results else None
122
-
123
- # ============================================
124
- # CHATBOT PARA PROMPTS SENSUALES
125
- # ============================================
126
-
127
- def create_sensual_prompt_system():
128
- """Sistema para el chatbot especializado en prompts sensuales"""
129
- return """Eres un chatbot especialista en generar prompts super sensuales en inglés.
130
-
131
- INSTRUCCIONES:
132
- 1. Responde naturalmente en español a conversaciones generales
133
- 2. Cuando el usuario pida prompts sensuales, genera SOLO el prompt en inglés dentro de ``` ```
134
- 3. Los prompts deben ser super sensuales, fotorealistas, insinuando una braguita de encaje bajo la vestimenta
135
- 4. Estructura: Full-body 9:16, ángulos bajos, poses sugerentes, lencería de encaje, mirada intensa
136
- 5. Ejemplo: "Photorealistic sensual portrait of [name], hinting at lace thong under dress..."
137
- 6. Incluye siempre el formato: --ar 9:16 --v 6 --style raw
138
- 7. Mantén respuestas concisas y enfocadas
139
- """
140
-
141
- def chat_sensual(message, chat_history):
142
- """Función principal del chatbot"""
143
- if not client_sambanova:
144
- chat_history.append((message, "⚠️ API no configurada. Configura SAMBANOVA_API_KEY."))
145
- return "", chat_history
146
-
147
- messages = [{"role": "system", "content": create_sensual_prompt_system()}]
148
-
149
- for user_msg, bot_msg in chat_history:
150
- messages.append({"role": "user", "content": user_msg})
151
- messages.append({"role": "assistant", "content": bot_msg})
152
-
153
- messages.append({"role": "user", "content": message})
154
-
155
- try:
156
- response = client_sambanova.chat.completions.create(
157
- model="Meta-Llama-3.1-8B-Instruct",
158
- messages=messages,
159
- temperature=0.8,
160
- max_tokens=500
161
- )
162
- bot_response = response.choices[0].message.content.strip()
163
- chat_history.append((message, bot_response))
164
- except Exception as e:
165
- chat_history.append((message, f"Error: {str(e)}"))
166
-
167
- return "", chat_history
168
-
169
- # ============================================
170
- # GENERADOR AUTOMÁTICO DE PROMPTS
171
  # ============================================
172
 
173
  def generate_random_prompt(name, role, intensity, scene_type):
174
  """Genera un prompt aleatorio completo"""
175
-
176
  # Elementos aleatorios
177
  lingerie = random.choice(LINGERIE_VARIATIONS)
178
  pose = random.choice(BOUDOIR_POSES)
179
  angle = random.choice(ANGLES)
180
  environment = random.choice(ENVIRONMENTS)
181
-
182
  # Determinar nivel de sensualidad
183
  intensity_levels = [
184
  ("subtly hinting at", "delicate", "gentle"),
185
  ("suggestively revealing", "sensual", "provocative"),
186
  ("boldly displaying", "explicit", "intense")
187
  ]
188
-
189
  level_idx = min(2, int(intensity / 33))
190
  hint_word, style_word, lighting_word = intensity_levels[level_idx]
191
-
192
  # Determinar si es celebridad o rol
193
  if role == "Celebrity":
194
  subject = name if name else "a beautiful woman"
@@ -196,7 +86,7 @@ def generate_random_prompt(name, role, intensity, scene_type):
196
  else:
197
  subject = f"{name} as a {random.choice(PROFESSIONAL_ROLES)}"
198
  outfit = f"professional {random.choice(['dress', 'suit', 'uniform'])}"
199
-
200
  # Determinar escena
201
  if scene_type == "Professional":
202
  environment = random.choice(["modern office", "boardroom", "luxury hotel", "art gallery"])
@@ -207,7 +97,7 @@ def generate_random_prompt(name, role, intensity, scene_type):
207
  else: # Intimate
208
  environment = random.choice(["bedroom", "dressing room", "bathroom", "private lounge"])
209
  action = "getting ready or enjoying private moments"
210
-
211
  # Construir el prompt
212
  prompt = f"""Photorealistic 8K {style_word} portrait of {subject}, {hint_word} her {lingerie} under her {outfit}.
213
 
@@ -230,32 +120,74 @@ def generate_random_prompt(name, role, intensity, scene_type):
230
  - Quality: 8K ultra-detailed, photorealistic
231
  - Parameters: --ar 9:16 --v 6 --style raw --stylize 200
232
  - Signature: Professional photography, no artifacts, perfect lighting"""
233
-
234
  return prompt.strip()
235
 
236
  def generate_auto_prompts(name, role_type, num_prompts, intensity, scene_type):
237
  """Genera múltiples prompts automáticos"""
238
  if not name.strip() and role_type == "Celebrity":
239
  return ["⚠️ Por favor ingresa un nombre de celebridad"] * 5
240
-
241
  prompts = []
242
-
243
  for i in range(min(num_prompts, 5)):
244
  prompt = generate_random_prompt(name, role_type, intensity, scene_type)
245
  prompts.append(prompt)
246
-
247
  # Rellenar si se piden menos de 5
248
  while len(prompts) < 5:
249
  prompts.append("")
250
-
251
  return prompts
252
 
253
- def copy_to_clipboard(text):
254
- """Copia texto al portapapeles"""
255
- if text and text.strip():
256
- pyperclip.copy(text.strip())
257
- return "✅ ¡Copiado al portapapeles!"
258
- return ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
 
260
  # ============================================
261
  # INTERFAZ PRINCIPAL
@@ -263,96 +195,95 @@ def copy_to_clipboard(text):
263
 
264
  with gr.Blocks(title="Sensual AI Studio", theme=gr.themes.Soft()) as demo:
265
  gr.Markdown("# 🌹 Sensual AI Studio")
266
- gr.Markdown("Generador especializado de prompts sensuales e imágenes")
267
-
268
- # ========== TAB 1: Chatbot ==========
269
  with gr.Tab("💬 Chatbot Sensual"):
270
  gr.Markdown("### Chatbot especialista en prompts sensuales")
271
  gr.Markdown("Habla naturalmente en español. Pide prompts y los recibirás en inglés listos para copiar.")
272
-
273
  chatbot = gr.Chatbot(height=400, bubble_full_width=False)
274
-
275
  with gr.Row():
276
  msg = gr.Textbox(
277
- placeholder="Ej: 'Genera un prompt super sensual para Emma Watson donde se insinúe su braguita de encaje'",
278
  label="Tu mensaje",
279
  scale=4
280
  )
281
  send_btn = gr.Button("Enviar", variant="primary", scale=1)
282
-
283
  with gr.Row():
284
  clear_btn = gr.Button("🧹 Limpiar chat")
285
  example_btn = gr.Button("💡 Ver ejemplos")
286
-
287
  # Ejemplos de prompts
288
  examples = gr.Examples(
289
  examples=[
290
- ["Genera un prompt sensual para Scarlett Johansson como secretaria"],
291
- ["Crea 3 prompts para una modelo con vestido negro y braguita de encaje"],
292
  ["Prompt para Ana de Armas en escena íntima"],
293
- ["Genera un prompt super sensual con ángulo bajo y mirada intensa"]
294
  ],
295
  inputs=[msg],
296
  label="Ejemplos de solicitudes"
297
  )
298
-
299
- send_btn.click(chat_sensual, [msg, chatbot], [msg, chatbot])
300
  clear_btn.click(lambda: [], None, chatbot)
301
- example_btn.click(lambda: gr.Info("Revisa los ejemplos abajo 👇"), None, None)
302
-
303
  # ========== TAB 2: Generador Automático ==========
304
  with gr.Tab("🎲 Generador Automático"):
305
  gr.Markdown("### Genera prompts sensuales automáticamente")
306
  gr.Markdown("Configura los parámetros y genera prompts con randomización.")
307
-
308
  with gr.Row():
309
  with gr.Column(scale=1):
310
  # Controles
311
  name_input = gr.Textbox(
312
  label="Nombre / Personaje",
313
  placeholder="Ej: Emma Watson, Jennifer, Sophia",
 
314
  max_lines=1
315
  )
316
-
317
  role_type = gr.Radio(
318
  choices=["Celebrity", "Professional Role"],
319
  value="Celebrity",
320
  label="Tipo de personaje"
321
  )
322
-
323
  scene_type = gr.Dropdown(
324
  choices=["Professional", "Casual", "Intimate"],
325
  value="Intimate",
326
  label="Tipo de escena"
327
  )
328
-
329
  num_prompts = gr.Slider(
330
  minimum=1, maximum=5, step=1, value=3,
331
  label="Número de Prompts"
332
  )
333
-
334
  intensity = gr.Slider(
335
  minimum=1, maximum=100, value=65,
336
  label="Intensidad Sensual",
337
  info="1 = Sutil, 100 = Explícito"
338
  )
339
-
340
  generate_auto = gr.Button("✨ Generar Prompts", variant="primary")
341
-
342
  # Información
343
  gr.Markdown("""
344
  ### 💡 Consejos:
345
  - Usa nombres de celebridades reales
346
  - Ajusta la intensidad según necesites
347
- - Combina diferentes tipos de escena
348
  - Los prompts están listos para Midjourney/DALL-E
 
349
  """)
350
-
351
  with gr.Column(scale=2):
352
  # Output de prompts
353
  prompt_outputs = []
354
- copy_buttons = []
355
-
356
  for i in range(5):
357
  with gr.Group(visible=i < 3) as group:
358
  gr.Markdown(f"### Prompt {i+1}")
@@ -360,21 +291,14 @@ with gr.Blocks(title="Sensual AI Studio", theme=gr.themes.Soft()) as demo:
360
  label="",
361
  lines=8,
362
  interactive=False,
363
- show_copy_button=True
364
  )
365
- with gr.Row():
366
- copy_btn = gr.Button(f"📋 Copiar Prompt {i+1}", size="sm", variant="secondary")
367
- copy_status = gr.Textbox(
368
- label="", interactive=False, visible=False, scale=4
369
- )
370
-
371
  prompt_outputs.append(prompt_box)
372
- copy_buttons.append((copy_btn, copy_status))
373
-
374
  # Funciones para mostrar/ocultar prompts
375
  def update_visibility(num):
376
  return [gr.update(visible=i < num) for i in range(5)]
377
-
378
  # Generar prompts
379
  generate_auto.click(
380
  fn=generate_auto_prompts,
@@ -385,162 +309,244 @@ with gr.Blocks(title="Sensual AI Studio", theme=gr.themes.Soft()) as demo:
385
  inputs=num_prompts,
386
  outputs=[group for group in demo.children if isinstance(group, gr.Group)]
387
  )
388
-
389
- # Botones de copiar
390
- for i, (copy_btn, copy_status) in enumerate(copy_buttons):
391
- copy_btn.click(
392
- fn=copy_to_clipboard,
393
- inputs=prompt_outputs[i],
394
- outputs=copy_status
395
- ).then(
396
- lambda i=i: gr.Info(f"Prompt {i+1} copiado al portapapeles!"),
397
- outputs=None
398
- )
399
-
400
- # ========== TAB 3: Generador de Imágenes ==========
401
- with gr.Tab("🖼️ REVE CREATE Images"):
402
- gr.Markdown("### Generador de imágenes con REVE CREATE")
403
- gr.Markdown("Pega cualquier prompt y genera imágenes sensuales de alta calidad.")
404
-
405
  with gr.Row():
406
  with gr.Column(scale=1):
407
- reve_key = gr.Textbox(
408
- label="🔑 REVE API Key",
409
- type="password",
410
- placeholder="Ingresa tu API key de REVE CREATE",
411
- info="[Obtén tu key aquí](https://reveai.xyz)"
412
  )
413
-
414
- gr.Markdown("### Configuración")
415
- reve_model = gr.Dropdown(
416
- choices=["reve-1", "reve-2", "reve-fast"],
417
- value="reve-fast",
418
- label="Modelo"
419
  )
420
- num_imgs = gr.Slider(1, 8, value=4, step=1, label="Número de imágenes")
421
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
422
  with gr.Column(scale=2):
423
- reve_prompt = gr.Textbox(
424
- label="📝 Prompt (en inglés)",
425
- placeholder="Pega aquí tu prompt sensual...\n\nEj: Photorealistic sensual portrait of a woman, hinting at lace thong under her dress, looking directly at viewer with seductive gaze, low-angle shot, 8K ultra-detailed --ar 9:16",
426
- lines=8
427
  )
428
-
429
- generate_reve = gr.Button("🎨 Generar Imágenes", variant="primary", size="lg")
430
-
431
- gallery = gr.Gallery(
432
- label="🖼️ Imágenes Generadas",
433
- columns=4,
434
- height="auto",
435
- object_fit="contain"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
436
  )
437
-
438
- # Función de generación
439
- generate_reve.click(
440
- fn=reve_generate_multiple,
441
- inputs=[reve_prompt, reve_key, reve_model, num_imgs],
442
- outputs=gallery
443
- )
444
-
445
- # ========== TAB 4: Instrucciones ==========
446
- with gr.Tab("📚 Guía y Configuración"):
447
  gr.Markdown("""
448
  # 📖 Guía Completa de Uso
449
-
450
  ## 🌟 Características Principales
451
-
452
  ### 1. 💬 **Chatbot Sensual**
453
  - Habla en español natural
454
- - Genera prompts en inglés dentro de ``` ```
455
- - Especializado en insinuar braguitas de encaje
456
- - Prompts listos para Midjourney, DALL-E, Stable Diffusion
457
-
458
  ### 2. 🎲 **Generador Automático**
459
  - Randomización inteligente
460
- - Control preciso de intensidad
461
  - 3 tipos de escenas: Profesional, Casual, Íntima
462
- - Botones de copiar con un clic
463
-
464
- ### 3. 🖼️ **REVE CREATE Images**
465
- - Generación de imágenes realistas
466
- - Hasta 8 imágenes simultáneas
467
- - Modelos optimizados para contenido sensual
468
- - Galería integrada
469
-
470
- ## 🔧 Configuración Necesaria
471
-
472
- ### API Keys:
473
- 1. **SAMBANOVA_API_KEY** (Opcional)
474
- - Para el chatbot inteligente
475
- - Si no la configuras, el chatbot mostrará mensaje de error
476
-
477
- 2. **REVE API Key** (Requerido para imágenes)
478
- - Regístrate en: https://reveai.xyz
479
- - Obtén tu key gratuita
480
- - Pégala en el campo correspondiente
481
-
482
- ## 📝 Ejemplos de Prompts Efectivos
483
-
484
  ### Para el Chatbot:
485
  ```
486
- "Genera un prompt super sensual para Margot Robbie donde se vea su braguita de encaje bajo el vestido"
487
- "Crea 2 prompts para una secretaria con falda ajustada"
488
- "Prompt íntimo para Gal Gadot en su habitación"
489
  ```
490
-
491
  ### Para el Generador Automático:
492
- - Nombre: `Emma Watson`
493
- - Tipo: `Celebrity`
494
- - Escena: `Professional`
495
- - Intensidad: `75`
496
-
497
- ### Para REVE CREATE:
 
 
 
 
 
 
 
 
 
 
 
498
  ```
499
- Photorealistic sensual portrait of Emma Watson as a corporate lawyer,
500
- hinting at black lace thong under her pencil skirt, looking directly
501
- at viewer with confident seductive gaze, low-angle shot from floor,
502
- professional office setting, cinematic lighting, 8K ultra-detailed --ar 9:16
 
 
 
 
 
503
  ```
504
-
505
- ## 🚀 Consejos Pro
506
-
507
- 1. **Para mejores resultados:**
508
- - específico con poses y ángulos
509
- - Usa adjetivos sensuales: "seductive", "alluring", "provocative"
510
- - Incluye detalles de textura: "lace patterns", "silk fabric", "skin texture"
511
-
512
- 2. **Optimización:**
513
- - Siempre incluye `--ar 9:16` para formato vertical
514
- - Usa `--v 6` para la última versión de Midjourney
515
- - Agrega `--style raw` para mayor realismo
516
-
517
- 3. **Ética y uso:**
518
- - Usa para contenido artístico y creativo
519
- - Respeta los derechos de imagen
520
- - Genera contenido para adultos con responsabilidad
521
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
522
  ## 🆘 Solución de Problemas
523
-
524
- ### Chatbot no responde:
525
- - Verifica tu SAMBANOVA_API_KEY
526
- - Asegúrate de pedir prompts explícitamente
527
-
528
- ### Imágenes no se generan:
529
- - Revisa tu REVE API Key
530
- - Verifica que el prompt esté en inglés
531
- - Prueba con el modelo "reve-fast"
532
-
533
- ### Prompts muy repetitivos:
534
- - Cambia el tipo de escena
535
- - Ajusta la intensidad
536
- - Usa diferentes nombres/roles
537
-
538
- ## 📞 Soporte
539
- - Para problemas técnicos: Revisa la consola del navegador
540
- - Para sugerencias: Modifica los arrays de datos en el código
541
- - Para personalización: Edita las funciones de generación
542
-
543
  ¡Disfruta creando contenido artístico y sensual! 🌹
 
 
544
  """)
545
 
546
  # ============================================
@@ -548,36 +554,15 @@ with gr.Blocks(title="Sensual AI Studio", theme=gr.themes.Soft()) as demo:
548
  # ============================================
549
 
550
  if __name__ == "__main__":
551
- # Instalar dependencias si faltan
552
- try:
553
- import pyperclip
554
- except ImportError:
555
- import subprocess
556
- import sys
557
- subprocess.check_call([sys.executable, "-m", "pip", "install", "pyperclip"])
558
-
559
- try:
560
- from openai import OpenAI
561
- except ImportError:
562
- import subprocess
563
- import sys
564
- subprocess.check_call([sys.executable, "-m", "pip", "install", "openai"])
565
-
566
- # Verificar dependencias
567
- required = ["gradio", "requests", "PIL"]
568
- for package in required:
569
- try:
570
- __import__(package.lower() if package == "PIL" else package)
571
- except ImportError:
572
- print(f"Instalando {package}...")
573
- subprocess.check_call([sys.executable, "-m", "pip", "install",
574
- "pillow" if package == "PIL" else package])
575
-
576
- # Lanzar la aplicación
577
  print("🚀 Iniciando Sensual AI Studio...")
 
 
 
 
578
  print("🌐 URL: http://localhost:7860")
579
- print("🔑 Recuerda configurar tus API keys si es necesario")
580
-
 
581
  demo.launch(
582
  server_name="0.0.0.0",
583
  server_port=7860,
 
1
  import gradio as gr
2
  import random
3
  import os
4
+ import json
 
 
 
 
 
 
 
5
 
6
  # ============================================
7
+ # DATOS PARA GENERACIÓN DE PROMPTS
8
  # ============================================
9
 
 
 
 
 
 
 
 
 
10
  LINGERIE_VARIATIONS = [
11
  "matching fiery red lace bra and thong set with thigh-high stockings",
12
  "sheer midnight black lingerie ensemble with transparent lace bra",
 
57
  ]
58
 
59
  # ============================================
60
+ # FUNCIONES DE GENERACIÓN DE PROMPTS
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  # ============================================
62
 
63
  def generate_random_prompt(name, role, intensity, scene_type):
64
  """Genera un prompt aleatorio completo"""
65
+
66
  # Elementos aleatorios
67
  lingerie = random.choice(LINGERIE_VARIATIONS)
68
  pose = random.choice(BOUDOIR_POSES)
69
  angle = random.choice(ANGLES)
70
  environment = random.choice(ENVIRONMENTS)
71
+
72
  # Determinar nivel de sensualidad
73
  intensity_levels = [
74
  ("subtly hinting at", "delicate", "gentle"),
75
  ("suggestively revealing", "sensual", "provocative"),
76
  ("boldly displaying", "explicit", "intense")
77
  ]
78
+
79
  level_idx = min(2, int(intensity / 33))
80
  hint_word, style_word, lighting_word = intensity_levels[level_idx]
81
+
82
  # Determinar si es celebridad o rol
83
  if role == "Celebrity":
84
  subject = name if name else "a beautiful woman"
 
86
  else:
87
  subject = f"{name} as a {random.choice(PROFESSIONAL_ROLES)}"
88
  outfit = f"professional {random.choice(['dress', 'suit', 'uniform'])}"
89
+
90
  # Determinar escena
91
  if scene_type == "Professional":
92
  environment = random.choice(["modern office", "boardroom", "luxury hotel", "art gallery"])
 
97
  else: # Intimate
98
  environment = random.choice(["bedroom", "dressing room", "bathroom", "private lounge"])
99
  action = "getting ready or enjoying private moments"
100
+
101
  # Construir el prompt
102
  prompt = f"""Photorealistic 8K {style_word} portrait of {subject}, {hint_word} her {lingerie} under her {outfit}.
103
 
 
120
  - Quality: 8K ultra-detailed, photorealistic
121
  - Parameters: --ar 9:16 --v 6 --style raw --stylize 200
122
  - Signature: Professional photography, no artifacts, perfect lighting"""
123
+
124
  return prompt.strip()
125
 
126
  def generate_auto_prompts(name, role_type, num_prompts, intensity, scene_type):
127
  """Genera múltiples prompts automáticos"""
128
  if not name.strip() and role_type == "Celebrity":
129
  return ["⚠️ Por favor ingresa un nombre de celebridad"] * 5
130
+
131
  prompts = []
132
+
133
  for i in range(min(num_prompts, 5)):
134
  prompt = generate_random_prompt(name, role_type, intensity, scene_type)
135
  prompts.append(prompt)
136
+
137
  # Rellenar si se piden menos de 5
138
  while len(prompts) < 5:
139
  prompts.append("")
140
+
141
  return prompts
142
 
143
+ # ============================================
144
+ # SIMULADOR DE CHATBOT (sin OpenAI)
145
+ # ============================================
146
+
147
+ # Respuestas predefinidas para el chatbot
148
+ CHATBOT_RESPONSES = {
149
+ "hola": "¡Hola! Soy tu asistente especializado en prompts sensuales. ¿En qué puedo ayudarte? Puedes pedirme prompts específicos o preguntar sobre generación de contenido sensual.",
150
+ "hello": "Hello! I'm your sensual prompt assistant. How can I help you today?",
151
+ "help": "Puedo ayudarte a generar prompts sensuales en inglés. Solo dime: 'Genera un prompt para [nombre/rol]' o 'Crea un prompt sensual para [situación]'",
152
+ "prompt": "Claro, aquí tienes un prompt sensual listo para copiar:\n\n```\nPhotorealistic sensual portrait of a beautiful woman, hinting at black lace thong under her elegant dress, looking directly at viewer with seductive gaze, low-angle shot, cinematic lighting, 8K ultra-detailed --ar 9:16 --v 6 --style raw\n```",
153
+ "ejemplo": "Ejemplo de prompt sensual:\n\n```\nSensual full-body portrait of Emma Watson as executive secretary, subtly revealing lace thong under pencil skirt, intense eye contact, professional office setting, dramatic lighting, photorealistic 8K --ar 9:16\n```",
154
+ "gracias": "¡De nada! Si necesitas más prompts o ajustes, no dudes en pedirlos. 😊"
155
+ }
156
+
157
+ def chat_sensual_simple(message, chat_history):
158
+ """Chatbot simple sin API externa"""
159
+
160
+ message_lower = message.lower()
161
+ response = ""
162
+
163
+ # Buscar respuesta predefinida
164
+ for key in CHATBOT_RESPONSES:
165
+ if key in message_lower:
166
+ response = CHATBOT_RESPONSES[key]
167
+ break
168
+
169
+ # Si no hay respuesta predefinida, generar un prompt
170
+ if not response:
171
+ keywords = ["genera", "crea", "prompt", "sensual", "para"]
172
+ if any(keyword in message_lower for keyword in keywords):
173
+ # Extraer nombre si está presente
174
+ name = "a beautiful woman"
175
+ if "para" in message_lower:
176
+ parts = message.split("para")
177
+ if len(parts) > 1:
178
+ name = parts[1].strip()
179
+
180
+ # Generar prompt aleatorio
181
+ lingerie = random.choice(LINGERIE_VARIATIONS)
182
+ pose = random.choice(BOUDOIR_POSES)
183
+ angle = random.choice(ANGLES)
184
+
185
+ response = f"""Aquí tienes tu prompt sensual:
186
+ else:
187
+ response = "Soy especialista en generar prompts sensuales. Puedes pedirme: 'Genera un prompt sensual para [nombre]' o 'Crea un prompt para [situación]'. Los prompts se generan en inglés listos para copiar. 😊"
188
+
189
+ chat_history.append((message, response))
190
+ return "", chat_history
191
 
192
  # ============================================
193
  # INTERFAZ PRINCIPAL
 
195
 
196
  with gr.Blocks(title="Sensual AI Studio", theme=gr.themes.Soft()) as demo:
197
  gr.Markdown("# 🌹 Sensual AI Studio")
198
+ gr.Markdown("Generador especializado de prompts sensuales - Sin dependencias externas")
199
+
200
+ # ========== TAB 1: Chatbot Simple ==========
201
  with gr.Tab("💬 Chatbot Sensual"):
202
  gr.Markdown("### Chatbot especialista en prompts sensuales")
203
  gr.Markdown("Habla naturalmente en español. Pide prompts y los recibirás en inglés listos para copiar.")
204
+
205
  chatbot = gr.Chatbot(height=400, bubble_full_width=False)
206
+
207
  with gr.Row():
208
  msg = gr.Textbox(
209
+ placeholder="Ej: 'Genera un prompt super sensual para Emma Watson'",
210
  label="Tu mensaje",
211
  scale=4
212
  )
213
  send_btn = gr.Button("Enviar", variant="primary", scale=1)
214
+
215
  with gr.Row():
216
  clear_btn = gr.Button("🧹 Limpiar chat")
217
  example_btn = gr.Button("💡 Ver ejemplos")
218
+
219
  # Ejemplos de prompts
220
  examples = gr.Examples(
221
  examples=[
222
+ ["Genera un prompt sensual para Scarlett Johansson"],
223
+ ["Crea 3 prompts para una modelo con vestido negro"],
224
  ["Prompt para Ana de Armas en escena íntima"],
225
+ ["Hola, ¿puedes ayudarme con prompts sensuales?"]
226
  ],
227
  inputs=[msg],
228
  label="Ejemplos de solicitudes"
229
  )
230
+
231
+ send_btn.click(chat_sensual_simple, [msg, chatbot], [msg, chatbot])
232
  clear_btn.click(lambda: [], None, chatbot)
233
+
 
234
  # ========== TAB 2: Generador Automático ==========
235
  with gr.Tab("🎲 Generador Automático"):
236
  gr.Markdown("### Genera prompts sensuales automáticamente")
237
  gr.Markdown("Configura los parámetros y genera prompts con randomización.")
238
+
239
  with gr.Row():
240
  with gr.Column(scale=1):
241
  # Controles
242
  name_input = gr.Textbox(
243
  label="Nombre / Personaje",
244
  placeholder="Ej: Emma Watson, Jennifer, Sophia",
245
+ value="Emma Watson",
246
  max_lines=1
247
  )
248
+
249
  role_type = gr.Radio(
250
  choices=["Celebrity", "Professional Role"],
251
  value="Celebrity",
252
  label="Tipo de personaje"
253
  )
254
+
255
  scene_type = gr.Dropdown(
256
  choices=["Professional", "Casual", "Intimate"],
257
  value="Intimate",
258
  label="Tipo de escena"
259
  )
260
+
261
  num_prompts = gr.Slider(
262
  minimum=1, maximum=5, step=1, value=3,
263
  label="Número de Prompts"
264
  )
265
+
266
  intensity = gr.Slider(
267
  minimum=1, maximum=100, value=65,
268
  label="Intensidad Sensual",
269
  info="1 = Sutil, 100 = Explícito"
270
  )
271
+
272
  generate_auto = gr.Button("✨ Generar Prompts", variant="primary")
273
+
274
  # Información
275
  gr.Markdown("""
276
  ### 💡 Consejos:
277
  - Usa nombres de celebridades reales
278
  - Ajusta la intensidad según necesites
 
279
  - Los prompts están listos para Midjourney/DALL-E
280
+ - Haz clic en 📋 para copiar
281
  """)
282
+
283
  with gr.Column(scale=2):
284
  # Output de prompts
285
  prompt_outputs = []
286
+
 
287
  for i in range(5):
288
  with gr.Group(visible=i < 3) as group:
289
  gr.Markdown(f"### Prompt {i+1}")
 
291
  label="",
292
  lines=8,
293
  interactive=False,
294
+ show_copy_button=True # Botón de copiar nativo de Gradio
295
  )
 
 
 
 
 
 
296
  prompt_outputs.append(prompt_box)
297
+
 
298
  # Funciones para mostrar/ocultar prompts
299
  def update_visibility(num):
300
  return [gr.update(visible=i < num) for i in range(5)]
301
+
302
  # Generar prompts
303
  generate_auto.click(
304
  fn=generate_auto_prompts,
 
309
  inputs=num_prompts,
310
  outputs=[group for group in demo.children if isinstance(group, gr.Group)]
311
  )
312
+
313
+ # ========== TAB 3: Generador Manual ==========
314
+ with gr.Tab("✍️ Editor de Prompts"):
315
+ gr.Markdown("### Crea y edita tus propios prompts")
316
+ gr.Markdown("Usa esta plantilla para crear prompts personalizados.")
317
+
 
 
 
 
 
 
 
 
 
 
 
318
  with gr.Row():
319
  with gr.Column(scale=1):
320
+ template_name = gr.Textbox(
321
+ label="Nombre/Modelo",
322
+ value="Emma Watson",
323
+ placeholder="Nombre o descripción"
 
324
  )
325
+
326
+ template_role = gr.Textbox(
327
+ label="Rol/Profesión",
328
+ value="Executive Secretary",
329
+ placeholder="Ej: CEO, Model, Doctor"
 
330
  )
331
+
332
+ template_lingerie = gr.Dropdown(
333
+ choices=LINGERIE_VARIATIONS,
334
+ value=LINGERIE_VARIATIONS[0],
335
+ label="Lencería"
336
+ )
337
+
338
+ template_pose = gr.Dropdown(
339
+ choices=BOUDOIR_POSES,
340
+ value=BOUDOIR_POSES[0],
341
+ label="Pose"
342
+ )
343
+
344
+ template_angle = gr.Dropdown(
345
+ choices=ANGLES,
346
+ value=ANGLES[0],
347
+ label="Ángulo de cámara"
348
+ )
349
+
350
+ template_scene = gr.Dropdown(
351
+ choices=ENVIRONMENTS,
352
+ value=ENVIRONMENTS[0],
353
+ label="Escenario"
354
+ )
355
+
356
  with gr.Column(scale=2):
357
+ template_output = gr.Textbox(
358
+ label="📝 Prompt Generado",
359
+ lines=10,
360
+ interactive=True
361
  )
362
+
363
+ with gr.Row():
364
+ generate_template = gr.Button("🔄 Generar desde plantilla", variant="primary")
365
+ clear_template = gr.Button("🧹 Limpiar")
366
+
367
+ # Función para generar prompt desde plantilla
368
+ def generate_from_template(name, role, lingerie, pose, angle, scene):
369
+ prompt = f"""Photorealistic sensual portrait of {name} as {role}, hinting at {lingerie.lower()}.
370
+
371
+ {pose}. {angle}.
372
+
373
+ Setting: {scene} with cinematic lighting.
374
+ Expression: Intense seductive gaze directly at viewer.
375
+ Atmosphere: Intimate and provocative.
376
+
377
+ Technical: 8K ultra-detailed, photorealistic skin texture, perfect lighting.
378
+ Parameters: --ar 9:16 --v 6 --style raw --stylize 200"""
379
+
380
+ return prompt
381
+
382
+ generate_template.click(
383
+ fn=generate_from_template,
384
+ inputs=[template_name, template_role, template_lingerie, template_pose, template_angle, template_scene],
385
+ outputs=template_output
386
  )
387
+
388
+ clear_template.click(lambda: "", None, template_output)
389
+
390
+ # ========== TAB 4: Guía y Plantillas ==========
391
+ with gr.Tab("📚 Guía y Plantillas"):
 
 
 
 
 
392
  gr.Markdown("""
393
  # 📖 Guía Completa de Uso
394
+
395
  ## 🌟 Características Principales
396
+
397
  ### 1. 💬 **Chatbot Sensual**
398
  - Habla en español natural
399
+ - Genera prompts en inglés dentro de \`\`\`
400
+ - Respuestas predefinidas inteligentes
401
+ - Sin necesidad de API externas
402
+
403
  ### 2. 🎲 **Generador Automático**
404
  - Randomización inteligente
405
+ - Control preciso de intensidad (1-100)
406
  - 3 tipos de escenas: Profesional, Casual, Íntima
407
+ - Hasta 5 prompts diferentes
408
+ - Botón de copiar nativo
409
+
410
+ ### 3. ✍️ **Editor de Prompts**
411
+ - Plantilla personalizable
412
+ - Dropdowns con opciones predefinidas
413
+ - Edición manual del prompt final
414
+
415
+ ## 🚀 Cómo Usar
416
+
 
 
 
 
 
 
 
 
 
 
 
 
417
  ### Para el Chatbot:
418
  ```
419
+ "Genera un prompt sensual para Margot Robbie"
420
+ "Crea un prompt para una secretaria"
421
+ "Hola, necesito ayuda con prompts"
422
  ```
423
+
424
  ### Para el Generador Automático:
425
+ 1. Ingresa un nombre (ej: Emma Watson)
426
+ 2. Selecciona tipo de personaje
427
+ 3. Elige tipo de escena
428
+ 4. Ajusta intensidad (65 es buen punto medio)
429
+ 5. Selecciona número de prompts
430
+ 6. Haz clic en "Generar Prompts"
431
+ 7. Copia con el botón 📋
432
+
433
+ ### Para el Editor Manual:
434
+ 1. Completa todos los campos
435
+ 2. Haz clic en "Generar desde plantilla"
436
+ 3. Edita manualmente si lo deseas
437
+ 4. Copia el resultado
438
+
439
+ ## 📝 Ejemplos de Prompts Efectivos
440
+
441
+ ### Plantilla Básica:
442
  ```
443
+ Photorealistic sensual portrait of [NAME], hinting at [LINGERIE].
444
+
445
+ [POSE]. [ANGLE].
446
+
447
+ Setting: [ENVIRONMENT] with cinematic lighting.
448
+ Expression: Intense seductive gaze directly at viewer.
449
+
450
+ Technical: 8K ultra-detailed, photorealistic.
451
+ Parameters: --ar 9:16 --v 6 --style raw --stylize 200
452
  ```
453
+
454
+ ### Ejemplo Completo:
455
+ ```
456
+ Photorealistic sensual portrait of Emma Watson as CEO,
457
+ hinting at black lace thong under her business suit.
458
+
459
+ Standing with one foot on chair, revealing lace thong.
460
+ Low-angle shot from floor looking up.
461
+
462
+ Setting: Modern office after hours with dramatic lighting.
463
+ Expression: Confident seductive gaze directly at viewer.
464
+
465
+ Technical: 8K ultra-detailed, photorealistic skin texture.
466
+ Parameters: --ar 9:16 --v 6 --style raw --stylize 200
467
+ ```
468
+
469
+ ## 🎨 Parámetros Recomendados
470
+
471
+ Para mejores resultados en Midjourney/DALL-E/Stable Diffusion:
472
+
473
+ - `--ar 9:16` - Formato vertical perfecto para retratos
474
+ - `--v 6` - Última versión de Midjourney
475
+ - `--style raw` - Más realismo, menos artistico
476
+ - `--stylize 180` - Buen balance entre creatividad y realismo
477
+
478
+ ## 💡 Consejos Pro
479
+
480
+ 1. **Para mayor realismo:**
481
+ - Usa "photorealistic" y "8K ultra-detailed"
482
+ - Incluye "skin texture" y "fabric details"
483
+ - Especifica "cinematic lighting"
484
+
485
+ 2. **Para intensidad sensual:**
486
+ - 1-33: "subtly hinting at" (sutil)
487
+ - 34-66: "suggestively revealing" (sugerente)
488
+ - 67-100: "boldly displaying" (explícito)
489
+
490
+ 3. **Variedad de escenas:**
491
+ - **Profesional:** Oficinas, hoteles, galerías
492
+ - **Casual:** Apartamentos, cafés, parques
493
+ - **Íntimo:** Dormitorios, baños, salas privadas
494
+
495
+ ## 🔧 Personalización
496
+
497
+ Puedes modificar los arrays de datos en el código:
498
+
499
+ ```python
500
+ # Agregar más opciones de lencería
501
+ LINGERIE_VARIATIONS.append("nueva lencería descripción")
502
+
503
+ # Agregar más poses
504
+ BOUDOIR_POSES.append("nueva pose sensual")
505
+
506
+ # Agregar más roles profesionales
507
+ PROFESSIONAL_ROLES.append("Nuevo Rol")
508
+ ```
509
+
510
+ ## ❓ Preguntas Frecuentes
511
+
512
+ ### ¿Necesito API keys?
513
+ **No.** Esta versión funciona completamente offline.
514
+
515
+ ### ¿Puedo usar estos prompts en otras plataformas?
516
+ **Sí.** Los prompts son compatibles con:
517
+ - Midjourney
518
+ - DALL-E 3
519
+ - Stable Diffusion
520
+ - Leonardo.ai
521
+ - Cualquier generador de imágenes
522
+
523
+ ### ¿Cómo copio los prompts?
524
+ Cada caja de texto tiene un botón 📋 nativo.
525
+ También puedes seleccionar manualmente y Ctrl+C.
526
+
527
+ ### ¿Puedo guardar mis prompts favoritos?
528
+ **Sí.** Copia y pégalos en un documento o usa el editor para guardar versiones.
529
+
530
  ## 🆘 Solución de Problemas
531
+
532
+ ### Los prompts no se generan:
533
+ - Verifica que hayas ingresado un nombre
534
+ - Asegúrate de hacer clic en "Generar Prompts"
535
+ - Recarga la página si es necesario
536
+
537
+ ### El chatbot no responde como esperas:
538
+ - Usa palabras clave: "genera", "crea", "prompt"
539
+ - específico con nombres y situaciones
540
+ - Usa los ejemplos como referencia
541
+
542
+ ### Quiero más opciones:
543
+ - Edita los arrays de datos en el código fuente
544
+ - Agrega tus propias variaciones
545
+ - Combina elementos manualmente en el editor
546
+
 
 
 
 
547
  ¡Disfruta creando contenido artístico y sensual! 🌹
548
+
549
+ *Nota: Esta herramienta es para contenido artístico creativo. Úsala responsablemente.*
550
  """)
551
 
552
  # ============================================
 
554
  # ============================================
555
 
556
  if __name__ == "__main__":
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
557
  print("🚀 Iniciando Sensual AI Studio...")
558
+ print("✅ Versión sin dependencias externas")
559
+ print("✅ Chatbot preprogramado")
560
+ print("✅ Generador automático con randomización")
561
+ print("✅ Editor manual de prompts")
562
  print("🌐 URL: http://localhost:7860")
563
+ print("📝 Listo para usar - Sin configuración necesaria")
564
+
565
+ # Lanzar la aplicación
566
  demo.launch(
567
  server_name="0.0.0.0",
568
  server_port=7860,