Update app.py
Browse files
app.py
CHANGED
|
@@ -271,30 +271,32 @@ with col1:
|
|
| 271 |
|
| 272 |
# Crear un único acordeón para fórmula, creatividad y ángulo
|
| 273 |
with st.expander("Personaliza tus emails"):
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
emotion = st.selectbox(
|
| 277 |
-
"¿Qué emoción quieres evocar?",
|
| 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
|
| 287 |
)
|
| 288 |
-
|
| 289 |
-
#
|
| 290 |
-
# Make sure "NINGUNO" appears first, then the rest alphabetically
|
| 291 |
angle_keys = ["NINGUNO"] + sorted([key for key in angles.keys() if key != "NINGUNO"])
|
| 292 |
selected_angle = st.selectbox(
|
| 293 |
"Selecciona un ángulo para tus emails",
|
| 294 |
options=angle_keys
|
| 295 |
)
|
| 296 |
|
| 297 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 298 |
uploaded_file = st.file_uploader("📄 Archivo o imagen de referencia",
|
| 299 |
type=['txt', 'pdf', 'docx', 'jpg', 'jpeg', 'png'])
|
| 300 |
|
|
@@ -303,10 +305,13 @@ with col1:
|
|
| 303 |
image_parts = None
|
| 304 |
|
| 305 |
if uploaded_file is not None:
|
|
|
|
| 306 |
file_type = uploaded_file.name.split('.')[-1].lower()
|
| 307 |
|
| 308 |
# Manejar archivos de texto
|
| 309 |
if file_type in ['txt', 'pdf', 'docx']:
|
|
|
|
|
|
|
| 310 |
if file_type == 'txt':
|
| 311 |
try:
|
| 312 |
file_content = uploaded_file.read().decode('utf-8')
|
|
|
|
| 271 |
|
| 272 |
# Crear un único acordeón para fórmula, creatividad y ángulo
|
| 273 |
with st.expander("Personaliza tus emails"):
|
| 274 |
+
# 1. Idea Creativa al principio con altura de 70px
|
| 275 |
+
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=70)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 276 |
|
| 277 |
+
# 2. Fórmula
|
| 278 |
selected_formula_key = st.selectbox(
|
| 279 |
"Selecciona una fórmula para tus emails",
|
| 280 |
options=list(email_formulas.email_formulas.keys()) # Updated reference
|
| 281 |
)
|
| 282 |
+
|
| 283 |
+
# 3. Ángulo
|
|
|
|
| 284 |
angle_keys = ["NINGUNO"] + sorted([key for key in angles.keys() if key != "NINGUNO"])
|
| 285 |
selected_angle = st.selectbox(
|
| 286 |
"Selecciona un ángulo para tus emails",
|
| 287 |
options=angle_keys
|
| 288 |
)
|
| 289 |
|
| 290 |
+
# 4. Emoción
|
| 291 |
+
emotion = st.selectbox(
|
| 292 |
+
"¿Qué emoción quieres evocar?",
|
| 293 |
+
options=["Curiosidad", "Miedo", "Esperanza", "Entusiasmo", "Confianza", "Urgencia"]
|
| 294 |
+
)
|
| 295 |
+
|
| 296 |
+
# 5. Creatividad (slider)
|
| 297 |
+
temperature = st.slider("Creatividad", min_value=0.0, max_value=2.0, value=1.0, step=0.1)
|
| 298 |
+
|
| 299 |
+
# 6. Lo demás (cargador de archivos)
|
| 300 |
uploaded_file = st.file_uploader("📄 Archivo o imagen de referencia",
|
| 301 |
type=['txt', 'pdf', 'docx', 'jpg', 'jpeg', 'png'])
|
| 302 |
|
|
|
|
| 305 |
image_parts = None
|
| 306 |
|
| 307 |
if uploaded_file is not None:
|
| 308 |
+
# El código para manejar archivos permanece igual
|
| 309 |
file_type = uploaded_file.name.split('.')[-1].lower()
|
| 310 |
|
| 311 |
# Manejar archivos de texto
|
| 312 |
if file_type in ['txt', 'pdf', 'docx']:
|
| 313 |
+
# El código para manejar archivos de texto permanece igual
|
| 314 |
+
# ...
|
| 315 |
if file_type == 'txt':
|
| 316 |
try:
|
| 317 |
file_content = uploaded_file.read().decode('utf-8')
|