Spaces:
Sleeping
Sleeping
Upload 4 files
Browse files- app.py +27 -51
- formulas.py +245 -114
app.py
CHANGED
|
@@ -5,7 +5,6 @@ import time
|
|
| 5 |
from dotenv import load_dotenv
|
| 6 |
from styles import get_custom_css, get_response_html_wrapper
|
| 7 |
from formulas import offer_formulas
|
| 8 |
-
from prompts import create_offer_instruction, create_promise_instruction
|
| 9 |
import PyPDF2
|
| 10 |
import docx
|
| 11 |
from PIL import Image
|
|
@@ -21,8 +20,8 @@ load_dotenv()
|
|
| 21 |
genai.configure(api_key=os.getenv('GOOGLE_API_KEY'))
|
| 22 |
model = genai.GenerativeModel('gemini-2.0-flash')
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
|
| 26 |
|
| 27 |
# Initialize session state variables if they don't exist
|
| 28 |
if 'submitted' not in st.session_state:
|
|
@@ -54,46 +53,48 @@ col1, col2 = st.columns([4, 6])
|
|
| 54 |
# Main input section in left column
|
| 55 |
with col1:
|
| 56 |
# Define the generate_offer function first
|
| 57 |
-
def handle_generate_button():
|
| 58 |
-
# Get file type if file is uploaded
|
| 59 |
-
is_image = False
|
| 60 |
-
if uploaded_file is not None:
|
| 61 |
-
file_type = uploaded_file.name.split('.')[-1].lower()
|
| 62 |
-
is_image = file_type in ['jpg', 'jpeg', 'png']
|
| 63 |
-
|
| 64 |
-
# Validate inputs
|
| 65 |
has_manual_input = bool(skills or product_service)
|
| 66 |
has_file_input = bool(uploaded_file is not None and not is_image)
|
| 67 |
has_image_input = bool(uploaded_file is not None and is_image)
|
| 68 |
-
|
|
|
|
| 69 |
if not (has_manual_input or has_file_input or has_image_input):
|
| 70 |
st.error('Por favor ingresa texto o sube un archivo/imagen')
|
| 71 |
return
|
| 72 |
|
| 73 |
-
# Update session state
|
| 74 |
st.session_state.submitted = True
|
| 75 |
-
st.session_state.generated = False
|
| 76 |
|
| 77 |
-
# Store inputs
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
st.session_state.formula_type = formula_type
|
| 82 |
|
| 83 |
if has_file_input:
|
| 84 |
st.session_state.file_content = file_content
|
| 85 |
|
| 86 |
if has_image_input:
|
| 87 |
-
st.session_state.
|
| 88 |
|
| 89 |
-
#
|
| 90 |
if has_image_input:
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
| 92 |
else:
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
-
#
|
| 96 |
-
|
|
|
|
|
|
|
| 97 |
|
| 98 |
# Keep only the manual input tab
|
| 99 |
with st.container():
|
|
@@ -195,37 +196,12 @@ with col2:
|
|
| 195 |
product_name = "Producto/Servicio"
|
| 196 |
|
| 197 |
# Get the instruction using the formula
|
| 198 |
-
# Usar la función actualizada
|
| 199 |
-
# In the generate_offer function or wherever the error is occurring
|
| 200 |
-
# The function definition needs proper indentation for its body
|
| 201 |
-
# Where you're generating the offer
|
| 202 |
-
def generate_offer():
|
| 203 |
-
# Get necessary variables
|
| 204 |
-
selected_formula_name = st.session_state.formula_type
|
| 205 |
-
avatar_description = st.session_state.target_audience
|
| 206 |
-
product_name = st.session_state.product_service
|
| 207 |
-
|
| 208 |
-
# Create the base instruction
|
| 209 |
instruction = create_offer_instruction(
|
| 210 |
avatar_description=avatar_description,
|
| 211 |
product_name=product_name,
|
| 212 |
-
selected_formula_name=
|
| 213 |
-
offer_formulas=offer_formulas
|
| 214 |
)
|
| 215 |
|
| 216 |
-
# Add file content if available
|
| 217 |
-
if st.session_state.input_type in ["file", "both"]:
|
| 218 |
-
additional_context = f"\n\nAdditional context from uploaded file:\n{st.session_state.file_content}"
|
| 219 |
-
instruction += additional_context
|
| 220 |
-
|
| 221 |
-
# Generate the response
|
| 222 |
-
response = model.generate_content(instruction)
|
| 223 |
-
offer_result = response.text
|
| 224 |
-
|
| 225 |
-
# Update session state
|
| 226 |
-
st.session_state.offer_result = offer_result
|
| 227 |
-
st.session_state.generated = True
|
| 228 |
-
|
| 229 |
# Add additional context based on input type
|
| 230 |
if st.session_state.input_type == "manual":
|
| 231 |
additional_context = f"""
|
|
|
|
| 5 |
from dotenv import load_dotenv
|
| 6 |
from styles import get_custom_css, get_response_html_wrapper
|
| 7 |
from formulas import offer_formulas
|
|
|
|
| 8 |
import PyPDF2
|
| 9 |
import docx
|
| 10 |
from PIL import Image
|
|
|
|
| 20 |
genai.configure(api_key=os.getenv('GOOGLE_API_KEY'))
|
| 21 |
model = genai.GenerativeModel('gemini-2.0-flash')
|
| 22 |
|
| 23 |
+
# Import the create_offer_instruction function from formulas
|
| 24 |
+
from formulas import create_offer_instruction, offer_formulas
|
| 25 |
|
| 26 |
# Initialize session state variables if they don't exist
|
| 27 |
if 'submitted' not in st.session_state:
|
|
|
|
| 53 |
# Main input section in left column
|
| 54 |
with col1:
|
| 55 |
# Define the generate_offer function first
|
| 56 |
+
def handle_generate_button(): # Renamed to avoid conflict
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
has_manual_input = bool(skills or product_service)
|
| 58 |
has_file_input = bool(uploaded_file is not None and not is_image)
|
| 59 |
has_image_input = bool(uploaded_file is not None and is_image)
|
| 60 |
+
|
| 61 |
+
# Simple validation - check if we have at least one input type
|
| 62 |
if not (has_manual_input or has_file_input or has_image_input):
|
| 63 |
st.error('Por favor ingresa texto o sube un archivo/imagen')
|
| 64 |
return
|
| 65 |
|
|
|
|
| 66 |
st.session_state.submitted = True
|
| 67 |
+
st.session_state.generated = False # Reset generated flag
|
| 68 |
|
| 69 |
+
# Store inputs based on what's available
|
| 70 |
+
if has_manual_input:
|
| 71 |
+
st.session_state.skills = skills if skills else ""
|
| 72 |
+
st.session_state.product_service = product_service if product_service else ""
|
|
|
|
| 73 |
|
| 74 |
if has_file_input:
|
| 75 |
st.session_state.file_content = file_content
|
| 76 |
|
| 77 |
if has_image_input:
|
| 78 |
+
st.session_state.image_parts = image_parts
|
| 79 |
|
| 80 |
+
# Set input type based on what's available
|
| 81 |
if has_image_input:
|
| 82 |
+
if has_manual_input:
|
| 83 |
+
st.session_state.input_type = "manual_image"
|
| 84 |
+
else:
|
| 85 |
+
st.session_state.input_type = "image"
|
| 86 |
else:
|
| 87 |
+
if has_manual_input and has_file_input:
|
| 88 |
+
st.session_state.input_type = "both"
|
| 89 |
+
elif has_file_input:
|
| 90 |
+
st.session_state.input_type = "file"
|
| 91 |
+
elif has_manual_input:
|
| 92 |
+
st.session_state.input_type = "manual"
|
| 93 |
|
| 94 |
+
# Store common settings
|
| 95 |
+
st.session_state.target_audience = target_audience
|
| 96 |
+
st.session_state.temperature = temperature
|
| 97 |
+
st.session_state.formula_type = formula_type
|
| 98 |
|
| 99 |
# Keep only the manual input tab
|
| 100 |
with st.container():
|
|
|
|
| 196 |
product_name = "Producto/Servicio"
|
| 197 |
|
| 198 |
# Get the instruction using the formula
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
instruction = create_offer_instruction(
|
| 200 |
avatar_description=avatar_description,
|
| 201 |
product_name=product_name,
|
| 202 |
+
selected_formula_name=st.session_state.formula_type
|
|
|
|
| 203 |
)
|
| 204 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
# Add additional context based on input type
|
| 206 |
if st.session_state.input_type == "manual":
|
| 207 |
additional_context = f"""
|
formulas.py
CHANGED
|
@@ -1,3 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
offer_formulas = {
|
| 2 |
"Oferta Dorada": {
|
| 3 |
"description": """
|
|
@@ -15,6 +189,27 @@ Analyze first:
|
|
| 15 |
- What are they trying to achieve without success?
|
| 16 |
- What limiting beliefs do they have?
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
---
|
| 19 |
|
| 20 |
#### 2 **QUANTIFIABLE PROMISE IN ALL CAPS**
|
|
@@ -41,12 +236,10 @@ In this part, we explain the result they will obtain, supported by an authority
|
|
| 41 |
**Incorrect example:**
|
| 42 |
"Grow your business with our strategy." (Doesn't say how long it will take or how reliable the strategy is).
|
| 43 |
|
| 44 |
-
**Correct
|
| 45 |
-
"
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
"Mediante nuestro sistema de automatización conseguirás generar ventas mientras duermes lo que significa libertad financiera real en menos de 90 días."
|
| 49 |
-
"Usando nuestra estrategia de redes sociales alcanzarás 10.000 seguidores cualificados transformando tu presencia digital en una máquina de generación de leads."
|
| 50 |
|
| 51 |
---
|
| 52 |
|
|
@@ -55,72 +248,43 @@ In this part, we explain the result they will obtain, supported by an authority
|
|
| 55 |
|
| 56 |
[QUANTIFIABLE PROMISE IN ALL CAPS]
|
| 57 |
|
| 58 |
-
[
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
""",
|
| 60 |
"examples": [
|
| 61 |
-
# Example 1
|
| 62 |
"""El 83% de los emprendedores pierden dinero en anuncios que nadie convierte.
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
# Example 2
|
| 69 |
"""Tu lista de email está tan muerta que hasta los mensajes de spam tienen más aperturas.
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
# Example 3
|
| 76 |
"""Mientras algunos facturan $10,000 al mes, tú sigues preguntándote por qué nadie compra.
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
# Example 4
|
| 83 |
"""Lo que nadie te dice sobre el marketing de contenidos es que el 95% nunca genera un solo cliente.
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
# Example 5
|
| 90 |
"""Ah, otro día más publicando en redes sociales y hablándole a las paredes... Qué divertido.
|
| 91 |
-
|
| 92 |
-
CONSIGUE 100 NUEVOS SEGUIDORES CUALIFICADOS POR SEMANA Y CONVIERTE EL 10% EN LEADS INTERESADOS EN TUS SERVICIOS.
|
| 93 |
-
|
| 94 |
-
Usando nuestra estrategia de contenido viral alcanzarás visibilidad exponencial transformando tu presencia en redes en un canal de captación automático en menos de 30 días."""
|
| 95 |
-
],
|
| 96 |
-
"custom_instructions": """
|
| 97 |
-
SPECIFIC INSTRUCTIONS FOR THIS FORMULA:
|
| 98 |
-
1. ATTENTION HOOK HANDLING:
|
| 99 |
-
- Analyze the avatar_description DEEPLY to understand their specific pain points, frustrations, and desires
|
| 100 |
-
- Select a powerful attention hook that DIRECTLY connects with the avatar's current reality
|
| 101 |
-
- Use statements, statistics, or shocking revelations, questions as hooks
|
| 102 |
-
- CUSTOMIZE the hook specifically for this avatar - don't use generic examples
|
| 103 |
-
- The hook MUST address the SAME problem that your promise will solve
|
| 104 |
-
|
| 105 |
-
2. MAINTAIN THEMATIC CONSISTENCY:
|
| 106 |
-
- The attention hook, quantifiable promise, and benefit statement MUST all address the SAME problem
|
| 107 |
-
- Create a LOGICAL PROGRESSION from problem (hook) to solution (promise) to implementation (benefit)
|
| 108 |
|
| 109 |
-
|
| 110 |
-
- Is written COMPLETELY IN CAPITAL LETTERS
|
| 111 |
-
- Includes concrete numbers (money, time, results)
|
| 112 |
-
- Uses powerful action verbs (EARN, MULTIPLY, ACHIEVE, MASTER)
|
| 113 |
-
- Specifies the exact result they will obtain
|
| 114 |
-
- Optionally includes time or effort required
|
| 115 |
-
- NEVER uses exclamation marks (!)
|
| 116 |
-
- DIRECTLY addresses the same problem mentioned in the hook
|
| 117 |
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
- Includes an authority element (proven method, studies, experience)
|
| 121 |
-
- Establishes a realistic timeframe or effort needed
|
| 122 |
-
- CONTINUES the same theme established in the hook and promise
|
| 123 |
-
"""
|
| 124 |
},
|
| 125 |
"Fórmula Sueño-Obstáculo": {
|
| 126 |
"description": """
|
|
@@ -167,56 +331,23 @@ This formula connects directly with the client's desires and concerns:
|
|
| 167 |
"Se trata de un (training, product or service) llamado ("name of your solution") que te va a permitir (big dream) aún y cuando (big obstacle)"
|
| 168 |
""",
|
| 169 |
"examples": [
|
| 170 |
-
"
|
| 171 |
-
|
| 172 |
-
"
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
- Content from uploaded files (if any)
|
| 189 |
-
|
| 190 |
-
3. Determine the most appropriate type (curso, webinar, entrenamiento, etc.) based on:
|
| 191 |
-
- Any type mentioned in product_name
|
| 192 |
-
- The nature of the solution described in avatar_description
|
| 193 |
-
- The most suitable format for the target audience's needs
|
| 194 |
-
|
| 195 |
-
4. Create a comprehensive offer by combining:
|
| 196 |
-
- The appropriate type (determined in step 3)
|
| 197 |
-
- The exact product name (if provided) or your created name (if needed)
|
| 198 |
-
- A compelling dream based on avatar_description
|
| 199 |
-
- A relevant obstacle based on avatar_description
|
| 200 |
-
|
| 201 |
-
5. The dream should be ambitious but believable, incorporating:
|
| 202 |
-
- Target audience desires from avatar_description
|
| 203 |
-
- Explicit goals mentioned in uploaded content (if any)
|
| 204 |
-
|
| 205 |
-
6. The obstacle should reflect:
|
| 206 |
-
- Real problems mentioned in avatar_description
|
| 207 |
-
- Challenges that would normally prevent achieving the dream
|
| 208 |
-
|
| 209 |
-
7. IMPORTANT: Vary the way you start the phrase. Instead of always using "Se trata de un...", use different openings such as:
|
| 210 |
-
- "Presentamos un..."
|
| 211 |
-
- "Te ofrecemos un..."
|
| 212 |
-
- "Descubre nuestro..."
|
| 213 |
-
- "Conoce el..."
|
| 214 |
-
- "Hemos creado un..."
|
| 215 |
-
- "Imagina tener acceso a un..."
|
| 216 |
-
- "Por fin existe un..."
|
| 217 |
-
- "Ahora puedes acceder a un..."
|
| 218 |
-
- "Tenemos para ti un..."
|
| 219 |
-
- "Disfruta de un..."
|
| 220 |
-
"""
|
| 221 |
}
|
| 222 |
}
|
|
|
|
| 1 |
+
import random
|
| 2 |
+
|
| 3 |
+
# Add this function at the beginning of the file
|
| 4 |
+
def create_offer_instruction(avatar_description, product_name, selected_formula_name):
|
| 5 |
+
"""
|
| 6 |
+
Creates instructions for generating an offer based on the selected formula.
|
| 7 |
+
|
| 8 |
+
Args:
|
| 9 |
+
avatar_description: Description of the target audience
|
| 10 |
+
product_name: Name of the product or service
|
| 11 |
+
selected_formula_name: Name of the formula to use ("Fórmula Sueño-Obstáculo" or "Oferta Dorada")
|
| 12 |
+
|
| 13 |
+
Returns:
|
| 14 |
+
str: Complete instruction for generating the offer
|
| 15 |
+
"""
|
| 16 |
+
# Get the selected formula
|
| 17 |
+
selected_formula = offer_formulas[selected_formula_name]
|
| 18 |
+
|
| 19 |
+
# Get random examples (1-3 examples)
|
| 20 |
+
num_examples = min(3, len(selected_formula["examples"]))
|
| 21 |
+
random_examples = random.sample(selected_formula["examples"], num_examples)
|
| 22 |
+
|
| 23 |
+
# Format examples
|
| 24 |
+
examples_text = "\n\n".join([f"Example {i+1}:\n{example}" for i, example in enumerate(random_examples)])
|
| 25 |
+
|
| 26 |
+
# Add specific instructions for Sueño-Obstáculo formula
|
| 27 |
+
# Add specific instructions for handling uploaded content
|
| 28 |
+
# Add specific instructions for each formula
|
| 29 |
+
additional_instructions = ""
|
| 30 |
+
if selected_formula_name == "Fórmula Sueño-Obstáculo":
|
| 31 |
+
additional_instructions = """
|
| 32 |
+
SPECIFIC INSTRUCTIONS FOR THIS FORMULA:
|
| 33 |
+
1. PRODUCT/SERVICE NAME HANDLING:
|
| 34 |
+
- If product_name is provided and not empty, use it EXACTLY as written
|
| 35 |
+
- If product_name is empty, generic (like "Producto/Servicio"), or contains placeholders, CREATE a compelling name that:
|
| 36 |
+
* Reflects the target audience's desires and challenges
|
| 37 |
+
* Communicates the main benefit or transformation
|
| 38 |
+
* Sounds professional and memorable
|
| 39 |
+
* Is specific to the niche or industry mentioned in avatar_description
|
| 40 |
+
- If product_name contains a full phrase like "Un curso llamado Inglés sin problemas", extract only the real name ("Inglés sin problemas")
|
| 41 |
+
|
| 42 |
+
2. Analyze ALL available information:
|
| 43 |
+
- Product/service name (product_name variable) or create one if needed
|
| 44 |
+
- Target audience description (avatar_description)
|
| 45 |
+
- Content from uploaded files (if any)
|
| 46 |
+
|
| 47 |
+
3. Determine the most appropriate type (curso, webinar, entrenamiento, etc.) based on:
|
| 48 |
+
- Any type mentioned in product_name
|
| 49 |
+
- The nature of the solution described in avatar_description
|
| 50 |
+
- The most suitable format for the target audience's needs
|
| 51 |
+
|
| 52 |
+
4. Create a comprehensive offer by combining:
|
| 53 |
+
- The appropriate type (determined in step 3)
|
| 54 |
+
- The exact product name (if provided) or your created name (if needed)
|
| 55 |
+
- A compelling dream based on avatar_description
|
| 56 |
+
- A relevant obstacle based on avatar_description
|
| 57 |
+
|
| 58 |
+
5. The dream should be ambitious but believable, incorporating:
|
| 59 |
+
- Target audience desires from avatar_description
|
| 60 |
+
- Explicit goals mentioned in uploaded content (if any)
|
| 61 |
+
|
| 62 |
+
6. The obstacle should reflect:
|
| 63 |
+
- Real problems mentioned in avatar_description
|
| 64 |
+
- Challenges that would normally prevent achieving the dream
|
| 65 |
+
|
| 66 |
+
7. IMPORTANT: Vary the way you start the phrase. Instead of always using "Se trata de un...", use different openings such as:
|
| 67 |
+
- "Presentamos un..."
|
| 68 |
+
- "Te ofrecemos un..."
|
| 69 |
+
- "Descubre nuestro..."
|
| 70 |
+
- "Conoce el..."
|
| 71 |
+
- "Hemos creado un..."
|
| 72 |
+
- "Imagina tener acceso a un..."
|
| 73 |
+
- "Por fin existe un..."
|
| 74 |
+
- "Ahora puedes acceder a un..."
|
| 75 |
+
- "Tenemos para ti un..."
|
| 76 |
+
- "Disfruta de un..."
|
| 77 |
+
|
| 78 |
+
8. CRITICAL: Output ONLY the offer itself with NO introductory text, explanations, or additional commentary.
|
| 79 |
+
- DO NOT include phrases like "Aquí tienes una oferta convincente" or "Esta es tu oferta"
|
| 80 |
+
- DO NOT include any text before or after the offer
|
| 81 |
+
- Start directly with one of the opening phrases from point 7
|
| 82 |
+
- The entire response should be ONLY the offer itself
|
| 83 |
+
"""
|
| 84 |
+
|
| 85 |
+
elif selected_formula_name == "Oferta Dorada":
|
| 86 |
+
additional_instructions = """
|
| 87 |
+
SPECIFIC INSTRUCTIONS FOR THIS FORMULA:
|
| 88 |
+
1. ATTENTION HOOK HANDLING:
|
| 89 |
+
- Analyze the avatar_description DEEPLY to understand their specific pain points, frustrations, and desires
|
| 90 |
+
- Select a powerful attention hook that DIRECTLY connects with the avatar's current reality
|
| 91 |
+
- DO NOT use questions as hooks - use statements, statistics, or shocking revelations instead
|
| 92 |
+
- CUSTOMIZE the hook specifically for this avatar - don't use generic examples
|
| 93 |
+
- CRITICAL: Ensure the hook is DIRECTLY RELATED to the promise and benefit that follow
|
| 94 |
+
- The hook MUST address the SAME problem that your promise will solve
|
| 95 |
+
|
| 96 |
+
Choose randomly from these hooks (avoiding questions) and CUSTOMIZE for your avatar:
|
| 97 |
+
- "El 83% de los emprendedores pierden dinero en anuncios que nadie convierte."
|
| 98 |
+
- "9 de cada 10 negocios online fracasan en sus primeros 6 meses por este error."
|
| 99 |
+
- "Lo que nadie te dice sobre el marketing digital es que la mayoría fracasa en los primeros 3 meses."
|
| 100 |
+
- "El secreto que las agencias de marketing no quieren que sepas sobre tu tráfico web."
|
| 101 |
+
- "Ah, otro día más tirando dinero en anuncios que no convierten... ¡Qué divertido!"
|
| 102 |
+
- "Felicidades, acabas de unirte al club de 'Invertí miles en mi web y nadie la visita'."
|
| 103 |
+
- "Tu lista de email está tan muerta que hasta los mensajes de spam tienen más aperturas."
|
| 104 |
+
- "Tu página de ventas convierte tan poco que hasta tu mamá cerró la pestaña sin comprar."
|
| 105 |
+
- "Mientras algunos facturan $10,000 al mes, tú sigues preguntándote por qué nadie compra."
|
| 106 |
+
- "Tus competidores están cerrando ventas mientras tú sigues 'perfeccionando' tu oferta."
|
| 107 |
+
- "La mayoría de cursos de marketing digital son una pérdida total de tiempo y dinero."
|
| 108 |
+
- "Tu estrategia actual de contenido está ahuyentando a tus clientes ideales."
|
| 109 |
+
- "Hace 6 meses estaba exactamente donde tú estás: creando contenido que nadie veía."
|
| 110 |
+
- "Recuerdo cuando mi negocio estaba al borde del colapso por no tener un sistema de ventas."
|
| 111 |
+
|
| 112 |
+
2. MAINTAIN THEMATIC CONSISTENCY:
|
| 113 |
+
- The attention hook, quantifiable promise, and benefit statement MUST all address the SAME problem
|
| 114 |
+
- If the hook mentions language learning struggles, the promise and benefit must also focus on language learning
|
| 115 |
+
- If the hook addresses marketing challenges, the promise and benefit must provide marketing solutions
|
| 116 |
+
- Create a LOGICAL PROGRESSION from problem (hook) to solution (promise) to implementation (benefit)
|
| 117 |
+
|
| 118 |
+
3. Analyze ALL available information:
|
| 119 |
+
- Target audience description (avatar_description) - THIS IS YOUR PRIMARY SOURCE OF TRUTH
|
| 120 |
+
- Product/service name (product_name variable)
|
| 121 |
+
- Content from uploaded files (if any)
|
| 122 |
+
|
| 123 |
+
4. Create a compelling QUANTIFIABLE PROMISE that:
|
| 124 |
+
- Is written COMPLETELY IN CAPITAL LETTERS
|
| 125 |
+
- Includes concrete numbers (money, time, results)
|
| 126 |
+
- Uses powerful action verbs (EARN, MULTIPLY, ACHIEVE, MASTER)
|
| 127 |
+
- Specifies the exact result they will obtain
|
| 128 |
+
- Optionally includes time or effort required
|
| 129 |
+
- NEVER uses exclamation marks (!)
|
| 130 |
+
- DIRECTLY addresses the same problem mentioned in the hook
|
| 131 |
+
|
| 132 |
+
5. Craft a benefit statement that:
|
| 133 |
+
- Clearly explains the result they will obtain
|
| 134 |
+
- Includes an authority element (proven method, studies, experience)
|
| 135 |
+
- Establishes a realistic timeframe or effort needed
|
| 136 |
+
- CONTINUES the same theme established in the hook and promise
|
| 137 |
+
|
| 138 |
+
6. CRITICAL: Output ONLY the offer itself with NO introductory text, explanations, or additional commentary.
|
| 139 |
+
- DO NOT include phrases like "Aquí tienes una oferta convincente" or "Esta es tu oferta"
|
| 140 |
+
- DO NOT include any text before or after the offer
|
| 141 |
+
- Start directly with the attention hook
|
| 142 |
+
- The entire response should be ONLY the offer itself following the formula structure
|
| 143 |
+
"""
|
| 144 |
+
|
| 145 |
+
# Create the instruction
|
| 146 |
+
instruction = f"""
|
| 147 |
+
You are a world-class expert copywriter, experienced in creating compelling offers that connect emotionally with the target audience.
|
| 148 |
+
|
| 149 |
+
OBJECTIVE:
|
| 150 |
+
- Generate a convincing offer in Spanish using the {selected_formula_name}
|
| 151 |
+
- Connect emotionally with the audience: {avatar_description}
|
| 152 |
+
- Address real desires, problems, and motivations
|
| 153 |
+
- Maintain natural and conversational language
|
| 154 |
+
|
| 155 |
+
FORMULA TO USE:
|
| 156 |
+
{selected_formula["description"]}
|
| 157 |
+
|
| 158 |
+
{additional_instructions}
|
| 159 |
+
|
| 160 |
+
EXAMPLES (Use these as inspiration but create something unique):
|
| 161 |
+
{examples_text}
|
| 162 |
+
|
| 163 |
+
PRODUCT/SERVICE:
|
| 164 |
+
{product_name}
|
| 165 |
+
|
| 166 |
+
TARGET AUDIENCE:
|
| 167 |
+
{avatar_description}
|
| 168 |
+
|
| 169 |
+
Create a compelling offer following the formula structure exactly.
|
| 170 |
+
"""
|
| 171 |
+
|
| 172 |
+
return instruction
|
| 173 |
+
|
| 174 |
+
# The rest of your offer_formulas dictionary remains unchanged
|
| 175 |
offer_formulas = {
|
| 176 |
"Oferta Dorada": {
|
| 177 |
"description": """
|
|
|
|
| 189 |
- What are they trying to achieve without success?
|
| 190 |
- What limiting beliefs do they have?
|
| 191 |
|
| 192 |
+
Then, randomly choose one of the following formats and CUSTOMIZE it for the specific avatar:
|
| 193 |
+
|
| 194 |
+
**Correct examples:**
|
| 195 |
+
"El 83% de los emprendedores pierden dinero en anuncios que nadie convierte."
|
| 196 |
+
"9 de cada 10 negocios online fracasan en sus primeros 6 meses por este error."
|
| 197 |
+
"Lo que nadie te dice sobre el marketing digital es que la mayoría fracasa en los primeros 3 meses."
|
| 198 |
+
"El secreto que las agencias de marketing no quieren que sepas sobre tu tráfico web."
|
| 199 |
+
"Ah, otro día más tirando dinero en anuncios que no convierten... ¡Qué divertido!"
|
| 200 |
+
"Felicidades, acabas de unirte al club de 'Invertí miles en mi web y nadie la visita'."
|
| 201 |
+
"¿Has pasado horas escribiendo emails y nadie los abre?"
|
| 202 |
+
"Tu lista de email está tan muerta que hasta los mensajes de spam tienen más aperturas."
|
| 203 |
+
"Tu página de ventas convierte tan poco que hasta tu mamá cerró la pestaña sin comprar."
|
| 204 |
+
"Mientras algunos facturan $10,000 al mes, tú sigues preguntándote por qué nadie compra."
|
| 205 |
+
"Tus competidores están cerrando ventas mientras tú sigues 'perfeccionando' tu oferta."
|
| 206 |
+
"La mayoría de cursos de marketing digital son una pérdida total de tiempo y dinero."
|
| 207 |
+
"Tu estrategia actual de contenido está ahuyentando a tus clientes ideales."
|
| 208 |
+
"Hace 6 meses estaba exactamente donde tú estás: creando contenido que nadie veía."
|
| 209 |
+
"Recuerdo cuando mi negocio estaba al borde del colapso por no tener un sistema de ventas."
|
| 210 |
+
|
| 211 |
+
The important thing is that it connects directly with the avatar's current reality and frustration, USING A VARIETY OF FORMATS AND CUSTOMIZING TO THE SPECIFIC AVATAR.
|
| 212 |
+
|
| 213 |
---
|
| 214 |
|
| 215 |
#### 2 **QUANTIFIABLE PROMISE IN ALL CAPS**
|
|
|
|
| 236 |
**Incorrect example:**
|
| 237 |
"Grow your business with our strategy." (Doesn't say how long it will take or how reliable the strategy is).
|
| 238 |
|
| 239 |
+
**Correct example:**
|
| 240 |
+
"Generate responses and sales with our strategy used by more than 500 entrepreneurs, with just 15 minutes a day."
|
| 241 |
+
|
| 242 |
+
This format clearly states the benefit, backs up the solution with authority, and establishes a realistic effort to achieve it.
|
|
|
|
|
|
|
| 243 |
|
| 244 |
---
|
| 245 |
|
|
|
|
| 248 |
|
| 249 |
[QUANTIFIABLE PROMISE IN ALL CAPS]
|
| 250 |
|
| 251 |
+
[Benefit] with [Authority element] in [Time or effort]"
|
| 252 |
+
|
| 253 |
+
---
|
| 254 |
+
|
| 255 |
+
### **Examples of the applied formula:**
|
| 256 |
""",
|
| 257 |
"examples": [
|
|
|
|
| 258 |
"""El 83% de los emprendedores pierden dinero en anuncios que nadie convierte.
|
| 259 |
+
|
| 260 |
+
CONVIERTE EL 30% DE TUS VISITANTES EN COMPRADORES Y REDUCE TU COSTO DE ADQUISICIÓN A LA MITAD EN SOLO 14 DÍAS.
|
| 261 |
+
|
| 262 |
+
Convierte más visitas en ventas con una estructura de copy validada en solo 5 días.""",
|
| 263 |
+
|
|
|
|
| 264 |
"""Tu lista de email está tan muerta que hasta los mensajes de spam tienen más aperturas.
|
| 265 |
+
|
| 266 |
+
AUMENTA TU TASA DE APERTURA AL 35% Y GENERA $2.500 EN VENTAS CON CADA CAMPAÑA DE EMAIL QUE ENVIES.
|
| 267 |
+
|
| 268 |
+
Haz que tus correos se lean con una estrategia usada por expertos en solo 30 minutos por campaña.""",
|
| 269 |
+
|
|
|
|
| 270 |
"""Mientras algunos facturan $10,000 al mes, tú sigues preguntándote por qué nadie compra.
|
| 271 |
+
|
| 272 |
+
FACTURA EL DOBLE SIN BAJAR TUS PRECIOS Y CONVIERTE EL 80% DE TUS PROPUESTAS EN CLIENTES PAGANDO.
|
| 273 |
+
|
| 274 |
+
Cierra más ventas con un método probado por 300 freelancers sin necesidad de descuentos en solo 7 días.""",
|
| 275 |
+
|
|
|
|
| 276 |
"""Lo que nadie te dice sobre el marketing de contenidos es que el 95% nunca genera un solo cliente.
|
| 277 |
+
|
| 278 |
+
MULTIPLICA POR 5 TUS COMENTARIOS Y CONSIGUE 3 CLIENTES NUEVOS CADA SEMANA CON SOLO 20 MINUTOS DE TRABAJO DIARIO.
|
| 279 |
+
|
| 280 |
+
Consigue comentarios y clientes con una estrategia de contenido validada en solo 10 minutos al día.""",
|
| 281 |
+
|
|
|
|
| 282 |
"""Ah, otro día más publicando en redes sociales y hablándole a las paredes... Qué divertido.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 283 |
|
| 284 |
+
CONSIGUE 100 NUEVOS SEGUIDORES CUALIFICADOS POR SEMANA Y CONVIERTE EL 10% EN LEADS INTERESADOS EN TUS SERVICIOS.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
|
| 286 |
+
Crea contenido irresistible con una estrategia validada en solo 15 minutos al día."""
|
| 287 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 288 |
},
|
| 289 |
"Fórmula Sueño-Obstáculo": {
|
| 290 |
"description": """
|
|
|
|
| 331 |
"Se trata de un (training, product or service) llamado ("name of your solution") que te va a permitir (big dream) aún y cuando (big obstacle)"
|
| 332 |
""",
|
| 333 |
"examples": [
|
| 334 |
+
"Presentamos un programa llamado \"Desbloqueo Creativo Total\" que te va a permitir generar ideas brillantes a demanda aún y cuando tu cerebro esté más seco que el desierto de Atacama.",
|
| 335 |
+
|
| 336 |
+
"Te ofrecemos un curso online llamado \"Máquina de Ventas Imparable\" que te va a permitir vender hasta a tu peor enemigo aún y cuando antes no podrías vender agua en el infierno.",
|
| 337 |
+
|
| 338 |
+
"Imagina tener acceso a un sistema llamado \"Productividad Sobrehumana\" que te va a permitir hacer en 2 horas lo que otros hacen en 2 días aún y cuando ahora mismo tu relación con la procrastinación sea más estable que tu último noviazgo.",
|
| 339 |
+
|
| 340 |
+
"Por fin existe una mentoría llamada \"Libertad Financiera Express\" que te va a permitir generar ingresos pasivos mientras duermes aún y cuando ahora mismo tu cuenta bancaria esté tan vacía que haga eco.",
|
| 341 |
+
|
| 342 |
+
"Hemos creado un método llamado \"Conquista Digital\" que te va a permitir posicionar tu marca en el top 1% de tu industria aún y cuando ahora mismo seas más invisible que un ninja en la oscuridad.",
|
| 343 |
+
|
| 344 |
+
"Conoce el taller llamado \"Oratoria Magnética\" que te va a permitir cautivar a cualquier audiencia aún y cuando ahora mismo hablar en público te cause más terror que una película de Stephen King.",
|
| 345 |
+
|
| 346 |
+
"Disfruta de una comunidad llamada \"Conexiones Estratégicas VIP\" que te va a permitir rodearte de personas que catapulten tu negocio aún y cuando tu red de contactos actual sea más pequeña que la lista de personas que han visitado Marte.",
|
| 347 |
+
|
| 348 |
+
"Ahora puedes acceder a un webinar llamado \"Dominio del Tiempo\" que te va a permitir recuperar 10 horas productivas a la semana aún y cuando ahora mismo tu agenda esté más saturada que el metro en hora punta.",
|
| 349 |
+
|
| 350 |
+
"Tenemos para ti una consultoría llamada \"Transformación de Marca 360°\" que te va a permitir destacar en un océano de competidores aún y cuando ahora mismo tu negocio pase más desapercibido que un camaleón en la selva."
|
| 351 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 352 |
}
|
| 353 |
}
|