Update app.py
Browse files
app.py
CHANGED
|
@@ -263,8 +263,8 @@ with col1:
|
|
| 263 |
target_audience = st.text_input("¿Quién es tu público objetivo?", placeholder="Ejemplo: Estudiantes Universitarios")
|
| 264 |
product = st.text_input("¿Qué producto/servicio estás promocionando?", placeholder="Ejemplo: Curso de Inglés")
|
| 265 |
|
| 266 |
-
#
|
| 267 |
-
|
| 268 |
|
| 269 |
# Only one submit button with a unique key
|
| 270 |
submit = st.button("Generar Emails", key="generate_emails_button")
|
|
@@ -278,8 +278,9 @@ with col1:
|
|
| 278 |
options=["Curiosidad", "Miedo", "Esperanza", "Entusiasmo", "Confianza", "Urgencia"]
|
| 279 |
)
|
| 280 |
|
| 281 |
-
|
| 282 |
-
|
|
|
|
| 283 |
selected_formula_key = st.selectbox(
|
| 284 |
"Selecciona una fórmula para tus emails",
|
| 285 |
options=list(email_formulas.email_formulas.keys()) # Updated reference
|
|
@@ -376,30 +377,31 @@ if submit:
|
|
| 376 |
|
| 377 |
if valid_inputs and selected_formula:
|
| 378 |
try:
|
| 379 |
-
# Use
|
| 380 |
-
with
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
<
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
|
|
|
| 403 |
except ValueError as e:
|
| 404 |
col2.error(f"Error: {str(e)}")
|
| 405 |
else:
|
|
|
|
| 263 |
target_audience = st.text_input("¿Quién es tu público objetivo?", placeholder="Ejemplo: Estudiantes Universitarios")
|
| 264 |
product = st.text_input("¿Qué producto/servicio estás promocionando?", placeholder="Ejemplo: Curso de Inglés")
|
| 265 |
|
| 266 |
+
# Move "Acción deseada" outside the accordion
|
| 267 |
+
desired_action = st.text_input("Acción deseada", placeholder="Ejemplo: Registrarse para una prueba gratuita")
|
| 268 |
|
| 269 |
# Only one submit button with a unique key
|
| 270 |
submit = st.button("Generar Emails", key="generate_emails_button")
|
|
|
|
| 278 |
options=["Curiosidad", "Miedo", "Esperanza", "Entusiasmo", "Confianza", "Urgencia"]
|
| 279 |
)
|
| 280 |
|
| 281 |
+
# Move "Idea Creativa" inside the accordion
|
| 282 |
+
creative_idea = st.text_area("Idea Creativa", placeholder="Ejemplo: Tu curso es como Netflix: ofrece contenido que engancha y soluciones que la gente realmente quiere ver", height=100)
|
| 283 |
+
|
| 284 |
selected_formula_key = st.selectbox(
|
| 285 |
"Selecciona una fórmula para tus emails",
|
| 286 |
options=list(email_formulas.email_formulas.keys()) # Updated reference
|
|
|
|
| 377 |
|
| 378 |
if valid_inputs and selected_formula:
|
| 379 |
try:
|
| 380 |
+
# Use spinner within col2 context
|
| 381 |
+
with col2:
|
| 382 |
+
with st.spinner("Creando los emails..."):
|
| 383 |
+
# Update the function call to include creative_idea
|
| 384 |
+
generated_emails = generate_emails(
|
| 385 |
+
target_audience,
|
| 386 |
+
product,
|
| 387 |
+
temperature,
|
| 388 |
+
selected_formula,
|
| 389 |
+
selected_angle,
|
| 390 |
+
file_content if 'file_content' in locals() else "",
|
| 391 |
+
image_parts if 'image_parts' in locals() else None,
|
| 392 |
+
is_image if 'is_image' in locals() else False,
|
| 393 |
+
emotion,
|
| 394 |
+
desired_action,
|
| 395 |
+
creative_idea # Add the creative idea parameter
|
| 396 |
+
)
|
| 397 |
+
|
| 398 |
+
# Display the generated emails in col2 (still within col2 context)
|
| 399 |
+
st.markdown(f"""
|
| 400 |
+
<div class="results-container">
|
| 401 |
+
<h4>Tus emails persuasivos:</h4>
|
| 402 |
+
<p>{generated_emails}</p>
|
| 403 |
+
</div>
|
| 404 |
+
""", unsafe_allow_html=True)
|
| 405 |
except ValueError as e:
|
| 406 |
col2.error(f"Error: {str(e)}")
|
| 407 |
else:
|