Update app.py
Browse files
app.py
CHANGED
|
@@ -324,7 +324,22 @@ with col1:
|
|
| 324 |
|
| 325 |
# Mostrar los titulares generados
|
| 326 |
if submit:
|
| 327 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 328 |
try:
|
| 329 |
generated_headlines = generate_headlines(
|
| 330 |
number_of_headlines,
|
|
@@ -346,4 +361,7 @@ if submit:
|
|
| 346 |
except ValueError as e:
|
| 347 |
col2.error(f"Error: {str(e)}")
|
| 348 |
else:
|
| 349 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
|
| 325 |
# Mostrar los titulares generados
|
| 326 |
if submit:
|
| 327 |
+
# Check if we have a valid combination of inputs
|
| 328 |
+
has_file = 'file_content' in locals() and file_content.strip() != ""
|
| 329 |
+
has_product = product.strip() != ""
|
| 330 |
+
has_audience = target_audience.strip() != ""
|
| 331 |
+
|
| 332 |
+
# Valid combinations:
|
| 333 |
+
# 1. File + Product (no audience needed)
|
| 334 |
+
# 2. File + Audience (no product needed)
|
| 335 |
+
# 3. Product + Audience (traditional way)
|
| 336 |
+
valid_inputs = (
|
| 337 |
+
(has_file and has_product) or
|
| 338 |
+
(has_file and has_audience) or
|
| 339 |
+
(has_product and has_audience)
|
| 340 |
+
)
|
| 341 |
+
|
| 342 |
+
if valid_inputs and selected_formula:
|
| 343 |
try:
|
| 344 |
generated_headlines = generate_headlines(
|
| 345 |
number_of_headlines,
|
|
|
|
| 361 |
except ValueError as e:
|
| 362 |
col2.error(f"Error: {str(e)}")
|
| 363 |
else:
|
| 364 |
+
if not selected_formula:
|
| 365 |
+
col2.error("Por favor, selecciona una fórmula.")
|
| 366 |
+
else:
|
| 367 |
+
col2.error("Por favor, proporciona al menos una de estas combinaciones: archivo + producto, archivo + público objetivo, o producto + público objetivo.")
|