JeCabrera commited on
Commit
a10e640
·
verified ·
1 Parent(s): f17e47f

Upload 9 files

Browse files
Files changed (2) hide show
  1. app.py +69 -12
  2. formulas/email_formulas.py +0 -0
app.py CHANGED
@@ -22,7 +22,7 @@ genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
22
  # email_formulas dictionary has been moved to formulas/email_formulas.py
23
 
24
  # Cambiar el nombre de la función
25
- def generate_emails(target_audience, product, temperature, selected_formula, selected_angle, file_content="", image_parts=None, is_image=False, emotion="", desired_action="", creative_idea=""):
26
  # Crear la configuración del modelo
27
  generation_config = {
28
  "temperature": temperature,
@@ -54,8 +54,44 @@ FORMAT RULES:
54
  # Incluir las instrucciones del sistema en el prompt principal
55
  system_prompt = f"""You are a world-class direct response copywriter trained by Gary Halbert, Gary Bencivenga, and David Ogilvy.
56
 
57
- You have helped many marketers before me persuade their clients through emotional email sequences.
58
- Your task is to create a 5-email sequence that makes my [buyer persona] feel [emotion] about my [product/service] and convince them to register/take [desired action].
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
  {format_instructions}
61
 
@@ -116,12 +152,25 @@ CREATIVE CONCEPT:
116
  Use the following creative concept as the central theme for all emails in the sequence:
117
  "{creative_idea}"
118
 
119
- CREATIVE CONCEPT INSTRUCTIONS:
120
- 1. This concept should be the unifying theme across all emails
121
- 2. Use it as a metaphor or analogy throughout the sequence
122
- 3. Develop different aspects of this concept in each email
123
- 4. Make sure the concept naturally connects to the product benefits
124
- 5. The concept should make the emails more memorable and engaging
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  """
126
 
127
  # Añadir contenido del archivo si existe
@@ -430,10 +479,17 @@ with col1:
430
  # 5. Emoción
431
  emotion = st.selectbox(
432
  "¿Qué emoción quieres evocar?",
433
- options=["Curiosidad", "Miedo", "Esperanza", "Entusiasmo", "Confianza", "Urgencia"],
434
  key="emotion_selectbox" # Add a unique key
435
  )
436
 
 
 
 
 
 
 
 
437
  # 6. Creatividad (slider)
438
  temperature = st.slider("Creatividad", min_value=0.0, max_value=2.0, value=1.0, step=0.1)
439
 
@@ -481,7 +537,7 @@ if submit:
481
  # Use spinner within col2 context
482
  with col2:
483
  with st.spinner("Creando los emails..."):
484
- # Update the function call to include creative_idea
485
  generated_emails = generate_emails(
486
  target_audience,
487
  product,
@@ -493,7 +549,8 @@ if submit:
493
  is_image,
494
  emotion,
495
  desired_action,
496
- creative_idea # Add the creative idea parameter
 
497
  )
498
 
499
  # Check if the response starts with "Error:"
 
22
  # email_formulas dictionary has been moved to formulas/email_formulas.py
23
 
24
  # Cambiar el nombre de la función
25
+ def generate_emails(target_audience, product, temperature, selected_formula, selected_angle, file_content="", image_parts=None, is_image=False, emotion="", desired_action="", creative_idea="", brand_tone=""):
26
  # Crear la configuración del modelo
27
  generation_config = {
28
  "temperature": temperature,
 
54
  # Incluir las instrucciones del sistema en el prompt principal
55
  system_prompt = f"""You are a world-class direct response copywriter trained by Gary Halbert, Gary Bencivenga, and David Ogilvy.
56
 
57
+ You understand how real people interact with emails in their busy inboxes:
58
+ - They quickly scan and delete anything that looks like generic marketing
59
+ - They only open emails that feel personal or spark genuine curiosity
60
+ - They respond to messages that seem written by a real person, not a corporation
61
+ - They engage with content that hooks them from the first line and maintains interest
62
+
63
+ Your task is to create a 5-email sequence that makes {target_audience} feel {'' if emotion == 'NINGUNO' else emotion + ' '}about {product} and convince them to {desired_action}.
64
+
65
+ AUDIENCE-SPECIFIC LANGUAGE ADAPTATION:
66
+ - Analyze the language patterns typical of {target_audience} and mirror them in your writing
67
+ - Adjust formality level based on audience demographics (more formal for professionals/executives, more casual for younger audiences)
68
+ - Use vocabulary, references, and examples that will resonate specifically with {target_audience}
69
+ - Match the communication style preferences of this audience (direct vs indirect, detailed vs concise)
70
+ - Include cultural touchpoints or shared experiences relevant to this specific audience
71
+ """
72
+
73
+ # Add brand tone instructions only if a specific tone is selected
74
+ if brand_tone != "NINGUNO":
75
+ system_prompt += f"""
76
+ BRAND TONE: {brand_tone}
77
+ - Write all emails using a consistent {brand_tone} tone of voice
78
+ - Ensure language, expressions, and style reflect this tone throughout
79
+ - Maintain this tone while still being persuasive and effective
80
+ """
81
+
82
+ system_prompt += f"""
83
+ Each email must follow these four essential actions:
84
+ 1. ATTRACT with a subject line that feels personal and creates curiosity (never screaming "Buy me!")
85
+ 2. CONNECT through rhythm, emotion, and storytelling that maintains interest until the end
86
+ 3. CONVINCE with authentic language that feels believable and relevant
87
+ 4. GUIDE to action naturally, making readers click almost without realizing it
88
+
89
+ WRITING STYLE:
90
+ - Write as if speaking to one person, not an audience
91
+ - Vary sentence length deliberately (mix short punchy sentences with occasional longer ones)
92
+ - Create natural paragraph rhythm (1-3 sentences per paragraph)
93
+ - Use conversational transitions between ideas
94
+ - Include specific details that make scenarios feel real
95
 
96
  {format_instructions}
97
 
 
152
  Use the following creative concept as the central theme for all emails in the sequence:
153
  "{creative_idea}"
154
 
155
+ CREATIVE CONCEPT INTEGRATION:
156
+ 1. WEAVING TECHNIQUE: Integrate this concept naturally throughout each email:
157
+ * Use it as a metaphor or analogy that connects to your product benefits
158
+ * Reference it in subject lines to create continuity across the sequence
159
+ * Develop different aspects of this concept in each email
160
+
161
+ 2. PROGRESSIVE DEVELOPMENT:
162
+ * Email 1: Introduce the concept in a simple, intriguing way
163
+ * Email 2: Expand on the concept, showing its relevance to the audience's situation
164
+ * Email 3: Deepen the concept by connecting it to specific product features
165
+ * Email 4: Apply the concept to overcome common objections
166
+ * Email 5: Bring the concept full circle, using it to drive the final call to action
167
+
168
+ 3. CREATIVE CONCEPT EXAMPLES:
169
+ * "Life is a journey" → Email 1 focuses on starting points, Email 5 on destinations
170
+ * "Your business as a garden" → Email 1 plants seeds, Email 5 shows full bloom
171
+ * "Breaking through walls" → Email 1 identifies walls, Email 5 celebrates freedom
172
+
173
+ The concept should make your emails more memorable, cohesive, and engaging while naturally leading to your product as the solution.
174
  """
175
 
176
  # Añadir contenido del archivo si existe
 
479
  # 5. Emoción
480
  emotion = st.selectbox(
481
  "¿Qué emoción quieres evocar?",
482
+ options=["NINGUNO", "Curiosidad", "Miedo", "Esperanza", "Entusiasmo", "Confianza", "Urgencia"],
483
  key="emotion_selectbox" # Add a unique key
484
  )
485
 
486
+ # Añadir selector de tono de marca
487
+ brand_tone = st.selectbox(
488
+ "Tono de marca",
489
+ options=["NINGUNO", "Profesional", "Conversacional", "Entusiasta", "Formal", "Informal", "Humorístico", "Sarcástico", "Serio", "Inspirador", "Educativo"],
490
+ key="brand_tone_selectbox"
491
+ )
492
+
493
  # 6. Creatividad (slider)
494
  temperature = st.slider("Creatividad", min_value=0.0, max_value=2.0, value=1.0, step=0.1)
495
 
 
537
  # Use spinner within col2 context
538
  with col2:
539
  with st.spinner("Creando los emails..."):
540
+ # Update the function call to include brand_tone
541
  generated_emails = generate_emails(
542
  target_audience,
543
  product,
 
549
  is_image,
550
  emotion,
551
  desired_action,
552
+ creative_idea,
553
+ brand_tone # Add the brand tone parameter
554
  )
555
 
556
  # Check if the response starts with "Error:"
formulas/email_formulas.py CHANGED
The diff for this file is too large to render. See raw diff