Update app.py
Browse files
app.py
CHANGED
|
@@ -98,7 +98,6 @@ BOTTOMS_SUMMER_DRESSES = [
|
|
| 98 |
"short floral print dress",
|
| 99 |
"wrap dress with a belt",
|
| 100 |
]
|
| 101 |
-
|
| 102 |
BOTTOMS_ELEGANT_DRESSES = [
|
| 103 |
"short dress with shiny embroidery that directs the gaze downwards",
|
| 104 |
"short empire-cut chiffon dress with a large slit",
|
|
@@ -213,6 +212,18 @@ ENVIRONMENTS = [
|
|
| 213 |
"couture atelier with rolls of fabric in the background and soft natural light",
|
| 214 |
"rooftop private cinema under the stars with romantic ambient light",
|
| 215 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
|
| 217 |
NEGATIVE_PROMPT = (
|
| 218 |
"(low quality, worst quality:1.4), (incorrect, deformed, distorted anatomy:1.3), blurry, "
|
|
@@ -301,12 +312,13 @@ def generate_single_prompt(name):
|
|
| 301 |
|
| 302 |
return prompt
|
| 303 |
|
| 304 |
-
def generate_prompts(name
|
| 305 |
"""Generates multiple prompts for a celebrity."""
|
| 306 |
if not name.strip():
|
| 307 |
-
|
|
|
|
| 308 |
name = name.strip()
|
| 309 |
-
return [generate_single_prompt(name) for _ in range(
|
| 310 |
|
| 311 |
# --- Gradio Interface ---
|
| 312 |
with gr.Blocks(theme=gr.themes.Soft(primary_hue="pink", secondary_hue="red")) as demo:
|
|
@@ -376,16 +388,20 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="pink", secondary_hue="red")) as
|
|
| 376 |
placeholder="Ex: Megan Fox, Scarlett Johansson, Ariana Grande...",
|
| 377 |
lines=1
|
| 378 |
)
|
|
|
|
|
|
|
| 379 |
num_prompts = gr.Slider(
|
| 380 |
-
label="Number of Prompts",
|
| 381 |
minimum=1,
|
| 382 |
maximum=5,
|
| 383 |
-
value=
|
| 384 |
-
step=1
|
|
|
|
| 385 |
)
|
| 386 |
generate_btn = gr.Button("Generate Sensual Prompts", variant="primary")
|
| 387 |
|
| 388 |
with gr.Column(scale=2):
|
|
|
|
| 389 |
prompt_outputs = [
|
| 390 |
gr.Textbox(
|
| 391 |
label=f"Prompt {i+1}",
|
|
@@ -395,9 +411,10 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="pink", secondary_hue="red")) as
|
|
| 395 |
) for i in range(5)
|
| 396 |
]
|
| 397 |
|
|
|
|
| 398 |
generate_btn.click(
|
| 399 |
-
fn=lambda name
|
| 400 |
-
inputs=[celebrity_name
|
| 401 |
outputs=prompt_outputs
|
| 402 |
)
|
| 403 |
|
|
|
|
| 98 |
"short floral print dress",
|
| 99 |
"wrap dress with a belt",
|
| 100 |
]
|
|
|
|
| 101 |
BOTTOMS_ELEGANT_DRESSES = [
|
| 102 |
"short dress with shiny embroidery that directs the gaze downwards",
|
| 103 |
"short empire-cut chiffon dress with a large slit",
|
|
|
|
| 212 |
"couture atelier with rolls of fabric in the background and soft natural light",
|
| 213 |
"rooftop private cinema under the stars with romantic ambient light",
|
| 214 |
]
|
| 215 |
+
# --- MISSING LISTS ADDED HERE ---
|
| 216 |
+
HAIRSTYLES = [
|
| 217 |
+
"long wavy hair", "sleek ponytail", "messy bun",
|
| 218 |
+
"voluminous curls", "short bob with bangs", "braided updo"
|
| 219 |
+
]
|
| 220 |
+
|
| 221 |
+
MAKEUP = [
|
| 222 |
+
"smoky eyes and nude lips", "bold red lipstick and a clean face",
|
| 223 |
+
"soft glam with a natural glow", "dramatic eyeliner and glossy lips",
|
| 224 |
+
"gothic style with dark lipstick and heavy eyeshadow"
|
| 225 |
+
]
|
| 226 |
+
# -----------------------------
|
| 227 |
|
| 228 |
NEGATIVE_PROMPT = (
|
| 229 |
"(low quality, worst quality:1.4), (incorrect, deformed, distorted anatomy:1.3), blurry, "
|
|
|
|
| 312 |
|
| 313 |
return prompt
|
| 314 |
|
| 315 |
+
def generate_prompts(name):
|
| 316 |
"""Generates multiple prompts for a celebrity."""
|
| 317 |
if not name.strip():
|
| 318 |
+
# Retorna 5 prompts con el mensaje de error para llenar todas las cajas de texto
|
| 319 |
+
return ["Please enter a celebrity name."] * 5
|
| 320 |
name = name.strip()
|
| 321 |
+
return [generate_single_prompt(name) for _ in range(5)]
|
| 322 |
|
| 323 |
# --- Gradio Interface ---
|
| 324 |
with gr.Blocks(theme=gr.themes.Soft(primary_hue="pink", secondary_hue="red")) as demo:
|
|
|
|
| 388 |
placeholder="Ex: Megan Fox, Scarlett Johansson, Ariana Grande...",
|
| 389 |
lines=1
|
| 390 |
)
|
| 391 |
+
# El slider ya no se usa para la l贸gica de generaci贸n
|
| 392 |
+
# Se puede eliminar o dejar como una sugerencia visual
|
| 393 |
num_prompts = gr.Slider(
|
| 394 |
+
label="Number of Prompts (Always generates 5)",
|
| 395 |
minimum=1,
|
| 396 |
maximum=5,
|
| 397 |
+
value=5, # Valor por defecto ajustado a 5
|
| 398 |
+
step=1,
|
| 399 |
+
interactive=False # Se hace no interactivo para evitar confusi贸n
|
| 400 |
)
|
| 401 |
generate_btn = gr.Button("Generate Sensual Prompts", variant="primary")
|
| 402 |
|
| 403 |
with gr.Column(scale=2):
|
| 404 |
+
# Se mantienen las 5 cajas de texto ya que la funci贸n siempre devuelve 5 resultados
|
| 405 |
prompt_outputs = [
|
| 406 |
gr.Textbox(
|
| 407 |
label=f"Prompt {i+1}",
|
|
|
|
| 411 |
) for i in range(5)
|
| 412 |
]
|
| 413 |
|
| 414 |
+
# La llamada a la funci贸n se ajusta para que no use el valor del slider
|
| 415 |
generate_btn.click(
|
| 416 |
+
fn=lambda name: generate_prompts(name),
|
| 417 |
+
inputs=[celebrity_name],
|
| 418 |
outputs=prompt_outputs
|
| 419 |
)
|
| 420 |
|