Update app.py
Browse files
app.py
CHANGED
@@ -87,22 +87,31 @@ ANALYSIS INSTRUCTIONS:
|
|
87 |
5. Use relevant terms, phrases, or concepts from the content
|
88 |
6. Maintain consistency with the brand identity or main message
|
89 |
7. Adapt the headlines to resonate with the provided content
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
IMPORTANT COMBINATIONS:
|
92 |
"""
|
93 |
# Updated conditions for specific input combinations
|
94 |
if product and not target_audience:
|
95 |
-
headlines_instruction += f"""- FILE + PRODUCT: You have a reference document and product ({product}). Create headlines that highlight this specific product's benefits and features using insights from the document. Extract audience information from the document to better target the headlines.
|
96 |
"""
|
97 |
elif target_audience and not product:
|
98 |
-
headlines_instruction += f"""- FILE + TARGET AUDIENCE: You have a reference document and target audience ({target_audience}). Create headlines tailored to this specific audience using language and concepts from the document. Identify products or services from the document that would appeal to this audience.
|
99 |
"""
|
100 |
elif product and target_audience:
|
101 |
-
headlines_instruction += f"""- PRODUCT + TARGET AUDIENCE: You have both product ({product}) and target audience ({target_audience}). Create headlines that connect this specific product with this specific audience, using insights from the document to strengthen the connection.
|
102 |
"""
|
103 |
|
104 |
headlines_instruction += """
|
105 |
-
IMPORTANT: Naturally integrate the elements found in the content with the selected formula and angle.
|
106 |
"""
|
107 |
|
108 |
# Añadir instrucciones de ángulo solo si no es "NINGUNO"
|
@@ -243,6 +252,13 @@ with col1:
|
|
243 |
|
244 |
# Crear un único acordeón para fórmula, creatividad y ángulo
|
245 |
with st.expander("Personaliza tus titulares"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
temperature = st.slider("Creatividad", min_value=0.0, max_value=2.0, value=1.0, step=0.1)
|
247 |
|
248 |
selected_formula_key = st.selectbox(
|
@@ -328,19 +344,27 @@ if submit:
|
|
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,
|
346 |
target_audience,
|
@@ -348,7 +372,7 @@ if submit:
|
|
348 |
temperature,
|
349 |
selected_formula,
|
350 |
selected_angle,
|
351 |
-
|
352 |
image_parts if 'image_parts' in locals() else None,
|
353 |
is_image if 'is_image' in locals() else False
|
354 |
)
|
@@ -364,4 +388,4 @@ if submit:
|
|
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,
|
|
|
87 |
5. Use relevant terms, phrases, or concepts from the content
|
88 |
6. Maintain consistency with the brand identity or main message
|
89 |
7. Adapt the headlines to resonate with the provided content
|
90 |
+
8. Identify any creative elements like characters, movies, cultural references, or storytelling devices
|
91 |
+
9. Incorporate these creative elements into your headlines when appropriate
|
92 |
+
|
93 |
+
CREATIVE CONTEXT GUIDELINES:
|
94 |
+
- If the content mentions specific characters, incorporate their traits or quotes in headlines
|
95 |
+
- If movie or pop culture references exist, use similar tone or style in headlines
|
96 |
+
- Match the emotional tone and creative direction of the original content
|
97 |
+
- Maintain the same storytelling approach if present in the content
|
98 |
+
- Use metaphors, analogies or creative devices similar to those in the content
|
99 |
|
100 |
IMPORTANT COMBINATIONS:
|
101 |
"""
|
102 |
# Updated conditions for specific input combinations
|
103 |
if product and not target_audience:
|
104 |
+
headlines_instruction += f"""- FILE + PRODUCT: You have a reference document and product ({product}). Create headlines that highlight this specific product's benefits and features using insights from the document. Extract audience information from the document to better target the headlines. Ensure headlines match the creative context and tone of the original content.
|
105 |
"""
|
106 |
elif target_audience and not product:
|
107 |
+
headlines_instruction += f"""- FILE + TARGET AUDIENCE: You have a reference document and target audience ({target_audience}). Create headlines tailored to this specific audience using language and concepts from the document. Identify products or services from the document that would appeal to this audience. Maintain the creative direction and contextual elements from the original content.
|
108 |
"""
|
109 |
elif product and target_audience:
|
110 |
+
headlines_instruction += f"""- PRODUCT + TARGET AUDIENCE: You have both product ({product}) and target audience ({target_audience}). Create headlines that connect this specific product with this specific audience, using insights from the document to strengthen the connection. Incorporate any creative elements, characters, or thematic approaches from the original content.
|
111 |
"""
|
112 |
|
113 |
headlines_instruction += """
|
114 |
+
IMPORTANT: Naturally integrate the elements found in the content with the selected formula and angle. If the content has a specific creative direction (storytelling, character-based, movie reference, etc.), ensure your headlines reflect this creative context while maintaining the formula structure.
|
115 |
"""
|
116 |
|
117 |
# Añadir instrucciones de ángulo solo si no es "NINGUNO"
|
|
|
252 |
|
253 |
# Crear un único acordeón para fórmula, creatividad y ángulo
|
254 |
with st.expander("Personaliza tus titulares"):
|
255 |
+
# Añadir área de texto para copy base
|
256 |
+
base_copy = st.text_area(
|
257 |
+
"Correo o copy para inspiración de titulares",
|
258 |
+
placeholder="Agrega aquí un texto que sirva como base para generar los titulares. Si lo dejas vacío, se generarán basados en el producto y público objetivo.",
|
259 |
+
height=150
|
260 |
+
)
|
261 |
+
|
262 |
temperature = st.slider("Creatividad", min_value=0.0, max_value=2.0, value=1.0, step=0.1)
|
263 |
|
264 |
selected_formula_key = st.selectbox(
|
|
|
344 |
has_file = 'file_content' in locals() and file_content.strip() != ""
|
345 |
has_product = product.strip() != ""
|
346 |
has_audience = target_audience.strip() != ""
|
347 |
+
has_base_copy = 'base_copy' in locals() and base_copy.strip() != ""
|
348 |
|
349 |
# Valid combinations:
|
350 |
# 1. File + Product (no audience needed)
|
351 |
# 2. File + Audience (no product needed)
|
352 |
# 3. Product + Audience (traditional way)
|
353 |
+
# 4. Base copy alone (new option)
|
354 |
valid_inputs = (
|
355 |
(has_file and has_product) or
|
356 |
(has_file and has_audience) or
|
357 |
+
(has_product and has_audience) or
|
358 |
+
has_base_copy
|
359 |
)
|
360 |
|
361 |
if valid_inputs and selected_formula:
|
362 |
try:
|
363 |
+
# If base_copy is provided, use it as file_content
|
364 |
+
content_for_generation = file_content if 'file_content' in locals() and file_content.strip() != "" else ""
|
365 |
+
if has_base_copy:
|
366 |
+
content_for_generation = base_copy
|
367 |
+
|
368 |
generated_headlines = generate_headlines(
|
369 |
number_of_headlines,
|
370 |
target_audience,
|
|
|
372 |
temperature,
|
373 |
selected_formula,
|
374 |
selected_angle,
|
375 |
+
content_for_generation,
|
376 |
image_parts if 'image_parts' in locals() else None,
|
377 |
is_image if 'is_image' in locals() else False
|
378 |
)
|
|
|
388 |
if not selected_formula:
|
389 |
col2.error("Por favor, selecciona una fórmula.")
|
390 |
else:
|
391 |
+
col2.error("Por favor, proporciona al menos una de estas combinaciones: archivo + producto, archivo + público objetivo, producto + público objetivo, o un texto de inspiración.")
|