Spaces:
Sleeping
Sleeping
| import random | |
| # Add this function at the beginning of the file | |
| def create_offer_instruction(avatar_description, product_name, selected_formula_name): | |
| """ | |
| Creates instructions for generating an offer based on the selected formula. | |
| Args: | |
| avatar_description: Description of the target audience | |
| product_name: Name of the product or service | |
| selected_formula_name: Name of the formula to use ("Fórmula Sueño-Obstáculo" or "Oferta Dorada") | |
| Returns: | |
| str: Complete instruction for generating the offer | |
| """ | |
| # Get the selected formula | |
| selected_formula = offer_formulas[selected_formula_name] | |
| # Get random examples (1-3 examples) | |
| num_examples = min(3, len(selected_formula["examples"])) | |
| random_examples = random.sample(selected_formula["examples"], num_examples) | |
| # Format examples | |
| examples_text = "\n\n".join([f"Example {i+1}:\n{example}" for i, example in enumerate(random_examples)]) | |
| # Add specific instructions for Sueño-Obstáculo formula | |
| # Add specific instructions for handling uploaded content | |
| # Add specific instructions for each formula | |
| additional_instructions = "" | |
| if selected_formula_name == "Fórmula Sueño-Obstáculo": | |
| additional_instructions = """ | |
| SPECIFIC INSTRUCTIONS FOR THIS FORMULA: | |
| 1. PRODUCT/SERVICE NAME HANDLING: | |
| - If product_name is provided and not empty, use it EXACTLY as written | |
| - If product_name is empty, generic (like "Producto/Servicio"), or contains placeholders, CREATE a compelling name that: | |
| * Reflects the target audience's desires and challenges | |
| * Communicates the main benefit or transformation | |
| * Sounds professional and memorable | |
| * Is specific to the niche or industry mentioned in avatar_description | |
| - If product_name contains a full phrase like "Un curso llamado Inglés sin problemas", extract only the real name ("Inglés sin problemas") | |
| 2. Analyze ALL available information: | |
| - Product/service name (product_name variable) or create one if needed | |
| - Target audience description (avatar_description) | |
| - Content from uploaded files (if any) | |
| 3. Determine the most appropriate type (curso, webinar, entrenamiento, etc.) based on: | |
| - Any type mentioned in product_name | |
| - The nature of the solution described in avatar_description | |
| - The most suitable format for the target audience's needs | |
| 4. Create a comprehensive offer by combining: | |
| - The appropriate type (determined in step 3) | |
| - The exact product name (if provided) or your created name (if needed) | |
| - A compelling dream based on avatar_description | |
| - A relevant obstacle based on avatar_description | |
| 5. The dream should be ambitious but believable, incorporating: | |
| - Target audience desires from avatar_description | |
| - Explicit goals mentioned in uploaded content (if any) | |
| 6. The obstacle should reflect: | |
| - Real problems mentioned in avatar_description | |
| - Challenges that would normally prevent achieving the dream | |
| 7. IMPORTANT: Vary the way you start the phrase. Instead of always using "Se trata de un...", use different openings such as: | |
| - "Presentamos un..." | |
| - "Te ofrecemos un..." | |
| - "Descubre nuestro..." | |
| - "Conoce el..." | |
| - "Hemos creado un..." | |
| - "Imagina tener acceso a un..." | |
| - "Por fin existe un..." | |
| - "Ahora puedes acceder a un..." | |
| - "Tenemos para ti un..." | |
| - "Disfruta de un..." | |
| 8. CRITICAL: Output ONLY the offer itself with NO introductory text, explanations, or additional commentary. | |
| - DO NOT include phrases like "Aquí tienes una oferta convincente" or "Esta es tu oferta" | |
| - DO NOT include any text before or after the offer | |
| - Start directly with one of the opening phrases from point 7 | |
| - The entire response should be ONLY the offer itself | |
| """ | |
| elif selected_formula_name == "Oferta Dorada": | |
| additional_instructions = """ | |
| SPECIFIC INSTRUCTIONS FOR THIS FORMULA: | |
| 1. ATTENTION HOOK HANDLING: | |
| - Analyze the avatar_description carefully to understand their pain points, frustrations, and desires | |
| - Select a powerful attention hook that directly connects with the avatar's current reality | |
| - DO NOT use questions as hooks - use statements, statistics, or shocking revelations instead | |
| - CUSTOMIZE the hook specifically for this avatar - don't use generic examples | |
| Choose randomly from these hooks (avoiding questions) and CUSTOMIZE for your avatar: | |
| - "El 83% de los emprendedores pierden dinero en anuncios que nadie convierte." | |
| - "9 de cada 10 negocios online fracasan en sus primeros 6 meses por este error." | |
| - "Lo que nadie te dice sobre el marketing digital es que la mayoría fracasa en los primeros 3 meses." | |
| - "El secreto que las agencias de marketing no quieren que sepas sobre tu tráfico web." | |
| - "Ah, otro día más tirando dinero en anuncios que no convierten... ¡Qué divertido!" | |
| - "Felicidades, acabas de unirte al club de 'Invertí miles en mi web y nadie la visita'." | |
| - "Tu lista de email está tan muerta que hasta los mensajes de spam tienen más aperturas." | |
| - "Tu página de ventas convierte tan poco que hasta tu mamá cerró la pestaña sin comprar." | |
| - "Mientras algunos facturan $10,000 al mes, tú sigues preguntándote por qué nadie compra." | |
| - "Tus competidores están cerrando ventas mientras tú sigues 'perfeccionando' tu oferta." | |
| - "La mayoría de cursos de marketing digital son una pérdida total de tiempo y dinero." | |
| - "Tu estrategia actual de contenido está ahuyentando a tus clientes ideales." | |
| - "Hace 6 meses estaba exactamente donde tú estás: creando contenido que nadie veía." | |
| - "Recuerdo cuando mi negocio estaba al borde del colapso por no tener un sistema de ventas." | |
| 2. Analyze ALL available information: | |
| - Target audience description (avatar_description) | |
| - Product/service name (product_name variable) | |
| - Content from uploaded files (if any) | |
| 3. Create a compelling QUANTIFIABLE PROMISE that: | |
| - Is written COMPLETELY IN CAPITAL LETTERS | |
| - Includes concrete numbers (money, time, results) | |
| - Uses powerful action verbs (EARN, MULTIPLY, ACHIEVE, MASTER) | |
| - Specifies the exact result they will obtain | |
| - Optionally includes time or effort required | |
| - NEVER uses exclamation marks (!) | |
| 4. Craft a benefit statement that: | |
| - Clearly explains the result they will obtain | |
| - Includes an authority element (proven method, studies, experience) | |
| - Establishes a realistic timeframe or effort needed | |
| 5. CRITICAL: Output ONLY the offer itself with NO introductory text, explanations, or additional commentary. | |
| - DO NOT include phrases like "Aquí tienes una oferta convincente" or "Esta es tu oferta" | |
| - DO NOT include any text before or after the offer | |
| - Start directly with the attention hook | |
| - The entire response should be ONLY the offer itself following the formula structure | |
| """ | |
| # Create the instruction | |
| instruction = f""" | |
| You are a world-class expert copywriter, experienced in creating compelling offers that connect emotionally with the target audience. | |
| OBJECTIVE: | |
| - Generate a convincing offer in Spanish using the {selected_formula_name} | |
| - Connect emotionally with the audience: {avatar_description} | |
| - Address real desires, problems, and motivations | |
| - Maintain natural and conversational language | |
| FORMULA TO USE: | |
| {selected_formula["description"]} | |
| {additional_instructions} | |
| EXAMPLES (Use these as inspiration but create something unique): | |
| {examples_text} | |
| PRODUCT/SERVICE: | |
| {product_name} | |
| TARGET AUDIENCE: | |
| {avatar_description} | |
| Create a compelling offer following the formula structure exactly. | |
| """ | |
| return instruction | |
| # The rest of your offer_formulas dictionary remains unchanged | |
| offer_formulas = { | |
| "Oferta Dorada": { | |
| "description": """ | |
| Formula: [Attention Hook + QUANTIFIABLE PROMISE IN ALL CAPS + Benefit + Authority + Time or Effort] | |
| This formula is designed to speak directly to the avatar, capturing their attention immediately, reflecting their current situation, and showing the transformation they desire. | |
| ### **How to apply it?** | |
| #### 1 **Attention Hook** | |
| The first step is to capture the avatar's attention with a powerful hook that can be a shocking revelation, an unexpected question, or a dramatic fact. IMPORTANT: CUSTOMIZE THE HOOK BASED ON THE AVATAR AND THEIR SPECIFIC PROBLEMS. Don't use generic examples, but adapt them to the client's situation. | |
| Analyze first: | |
| - What is the avatar's biggest pain or frustration? | |
| - What are they trying to achieve without success? | |
| - What limiting beliefs do they have? | |
| Then, randomly choose one of the following formats and CUSTOMIZE it for the specific avatar: | |
| **Correct examples:** | |
| "El 83% de los emprendedores pierden dinero en anuncios que nadie convierte." | |
| "9 de cada 10 negocios online fracasan en sus primeros 6 meses por este error." | |
| "Lo que nadie te dice sobre el marketing digital es que la mayoría fracasa en los primeros 3 meses." | |
| "El secreto que las agencias de marketing no quieren que sepas sobre tu tráfico web." | |
| "Ah, otro día más tirando dinero en anuncios que no convierten... ¡Qué divertido!" | |
| "Felicidades, acabas de unirte al club de 'Invertí miles en mi web y nadie la visita'." | |
| "¿Has pasado horas escribiendo emails y nadie los abre?" | |
| "Tu lista de email está tan muerta que hasta los mensajes de spam tienen más aperturas." | |
| "Tu página de ventas convierte tan poco que hasta tu mamá cerró la pestaña sin comprar." | |
| "Mientras algunos facturan $10,000 al mes, tú sigues preguntándote por qué nadie compra." | |
| "Tus competidores están cerrando ventas mientras tú sigues 'perfeccionando' tu oferta." | |
| "La mayoría de cursos de marketing digital son una pérdida total de tiempo y dinero." | |
| "Tu estrategia actual de contenido está ahuyentando a tus clientes ideales." | |
| "Hace 6 meses estaba exactamente donde tú estás: creando contenido que nadie veía." | |
| "Recuerdo cuando mi negocio estaba al borde del colapso por no tener un sistema de ventas." | |
| 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. | |
| --- | |
| #### 2 **QUANTIFIABLE PROMISE IN ALL CAPS** | |
| This is the most important part. You must create a specific, quantifiable promise written COMPLETELY IN CAPITAL LETTERS that immediately captures attention. It must include: | |
| - Concrete numbers (money, time, results) | |
| - Powerful action verbs (EARN, MULTIPLY, ACHIEVE, MASTER) | |
| - The specific result they will obtain | |
| - Optionally, the time or effort required | |
| - IMPORTANT: DO NOT USE EXCLAMATION MARKS (!) IN THIS SECTION UNDER ANY CIRCUMSTANCES | |
| **Incorrect example:** | |
| "Improve your sales with our system." (Vague, no numbers, no impact). | |
| "¡MULTIPLY YOUR SALES IN RECORD TIME!" (Uses exclamation marks, NEVER use them). | |
| **Correct example:** | |
| "FACTURA MAS DE $1.000 USD USANDO 15 EMAILS ESCRITOS EN 15 MINUTOS CADA UNO" (Specific, quantifiable, impactful). | |
| "MULTIPLICA POR 3 TUS INTERACCIONES EN REDES SOCIALES EN SOLO 2 SEMANAS" (Clear, measurable, with defined time). | |
| --- | |
| #### 3 **Benefit + Authority + Time or Effort** | |
| In this part, we explain the result they will obtain, supported by an authority factor (proven method, studies, experience, validations) and establishing a time frame or necessary effort to achieve it. | |
| **Incorrect example:** | |
| "Grow your business with our strategy." (Doesn't say how long it will take or how reliable the strategy is). | |
| **Correct example:** | |
| "Generate responses and sales with our strategy used by more than 500 entrepreneurs, with just 15 minutes a day." | |
| This format clearly states the benefit, backs up the solution with authority, and establishes a realistic effort to achieve it. | |
| --- | |
| ### **Fixed structure:** | |
| "[Varied Attention Hook] | |
| [QUANTIFIABLE PROMISE IN ALL CAPS] | |
| [Benefit] with [Authority element] in [Time or effort]" | |
| --- | |
| ### **Examples of the applied formula:** | |
| """, | |
| "examples": [ | |
| """El 83% de los emprendedores pierden dinero en anuncios que nadie convierte. | |
| CONVIERTE EL 30% DE TUS VISITANTES EN COMPRADORES Y REDUCE TU COSTO DE ADQUISICIÓN A LA MITAD EN SOLO 14 DÍAS. | |
| Convierte más visitas en ventas con una estructura de copy validada en solo 5 días.""", | |
| """Tu lista de email está tan muerta que hasta los mensajes de spam tienen más aperturas. | |
| AUMENTA TU TASA DE APERTURA AL 35% Y GENERA $2.500 EN VENTAS CON CADA CAMPAÑA DE EMAIL QUE ENVIES. | |
| Haz que tus correos se lean con una estrategia usada por expertos en solo 30 minutos por campaña.""", | |
| """Mientras algunos facturan $10,000 al mes, tú sigues preguntándote por qué nadie compra. | |
| FACTURA EL DOBLE SIN BAJAR TUS PRECIOS Y CONVIERTE EL 80% DE TUS PROPUESTAS EN CLIENTES PAGANDO. | |
| Cierra más ventas con un método probado por 300 freelancers sin necesidad de descuentos en solo 7 días.""", | |
| """Lo que nadie te dice sobre el marketing de contenidos es que el 95% nunca genera un solo cliente. | |
| MULTIPLICA POR 5 TUS COMENTARIOS Y CONSIGUE 3 CLIENTES NUEVOS CADA SEMANA CON SOLO 20 MINUTOS DE TRABAJO DIARIO. | |
| Consigue comentarios y clientes con una estrategia de contenido validada en solo 10 minutos al día.""", | |
| """Ah, otro día más publicando en redes sociales y hablándole a las paredes... Qué divertido. | |
| CONSIGUE 100 NUEVOS SEGUIDORES CUALIFICADOS POR SEMANA Y CONVIERTE EL 10% EN LEADS INTERESADOS EN TUS SERVICIOS. | |
| Crea contenido irresistible con una estrategia validada en solo 15 minutos al día.""" | |
| ] | |
| }, | |
| "Fórmula Sueño-Obstáculo": { | |
| "description": """ | |
| Formula: [Type + Name + Dream + Obstacle] | |
| This formula connects directly with the client's desires and concerns: | |
| 1. Type: The type of solution (training, product, or service) | |
| 2. Name: The name of your solution | |
| 3. Dream: The big dream or result that the client wants to achieve | |
| 4. Obstacle: The obstacle that would normally prevent achieving that dream | |
| **Suggested solution types:** | |
| - Online course | |
| - Webinar | |
| - Training | |
| - Program | |
| - Workshop | |
| - Mentorship | |
| - Consulting | |
| - Membership | |
| - System | |
| - Method | |
| - Service | |
| - Product | |
| - Application | |
| - Community | |
| - Masterclass | |
| **Suggested opening variations:** | |
| - "Se trata de un..." | |
| - "Presentamos un..." | |
| - "Te ofrecemos un..." | |
| - "Descubre nuestro..." | |
| - "Conoce el..." | |
| - "Hemos creado un..." | |
| - "Imagina tener acceso a un..." | |
| - "Por fin existe un..." | |
| - "Ahora puedes acceder a un..." | |
| - "Tenemos para ti un..." | |
| - "Disfruta de un..." | |
| **Structure Format (Classic example):** | |
| "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)" | |
| """, | |
| "examples": [ | |
| "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.", | |
| "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.", | |
| "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.", | |
| "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.", | |
| "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.", | |
| "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.", | |
| "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.", | |
| "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.", | |
| "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." | |
| ] | |
| } | |
| } |