Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- bullets/__init__.py +5 -0
- bullets/formulas.py +104 -0
- bullets/generator.py +29 -0
bullets/__init__.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .generator import generate_bullets
|
| 2 |
+
from .formulas import bullet_formulas, create_bullet_instruction
|
| 3 |
+
|
| 4 |
+
# Export the main functions and variables
|
| 5 |
+
__all__ = ['generate_bullets', 'bullet_formulas', 'create_bullet_instruction']
|
bullets/formulas.py
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
bullet_formulas = {
|
| 2 |
+
"Beneficios con Emojis": {
|
| 3 |
+
"description": """
|
| 4 |
+
Formula: [5 Benefit Bullets with Emojis]
|
| 5 |
+
|
| 6 |
+
Esta fórmula genera 5 bullets de beneficios poderosos, cada uno comenzando con un emoji relevante.
|
| 7 |
+
Cada bullet está diseñado para destacar un aspecto específico del valor que ofrece tu producto o servicio.
|
| 8 |
+
|
| 9 |
+
### **Cómo aplicarla?**
|
| 10 |
+
|
| 11 |
+
#### 1 **Bullets de Beneficios con Emojis**
|
| 12 |
+
Cada bullet debe:
|
| 13 |
+
- Comenzar con un emoji relevante
|
| 14 |
+
- Ser específico y tangible
|
| 15 |
+
- Enfocarse en resultados y transformaciones
|
| 16 |
+
- Incluir al menos un beneficio emocional
|
| 17 |
+
- Incluir al menos un beneficio relacionado con ahorro de tiempo o esfuerzo
|
| 18 |
+
|
| 19 |
+
**Estructura de los bullets:**
|
| 20 |
+
✅ [Beneficio específico 1 relacionado con resultados]
|
| 21 |
+
🚀 [Beneficio específico 2 relacionado con velocidad/facilidad]
|
| 22 |
+
💰 [Beneficio específico 3 relacionado con dinero/ahorro]
|
| 23 |
+
😌 [Beneficio específico 4 relacionado con tranquilidad/confianza]
|
| 24 |
+
🔄 [Beneficio específico 5 relacionado con transformación]
|
| 25 |
+
""",
|
| 26 |
+
"examples": [
|
| 27 |
+
# Example 1 - Marketing Digital
|
| 28 |
+
"""✅ Domina las 3 estrategias de copywriting que aumentan tu tasa de conversión en un 47% desde la primera semana de implementación
|
| 29 |
+
🚀 Implementa el sistema completo en solo 3 días, sin necesidad de contratar diseñadores o programadores
|
| 30 |
+
💰 Ahorra hasta $2,000 mensuales en publicidad gracias a mejores tasas de conversión orgánica
|
| 31 |
+
😌 Elimina la ansiedad de las ventas con un proceso estructurado y predecible que funciona incluso cuando duermes
|
| 32 |
+
🔄 Transforma tu mentalidad de "vendedor insistente" a "asesor de confianza" que los clientes buscan y recomiendan""",
|
| 33 |
+
|
| 34 |
+
# Example 2 - Fitness
|
| 35 |
+
"""✅ Pierde entre 5-8 kilos en las primeras 4 semanas siguiendo nuestro método de nutrición personalizada
|
| 36 |
+
🚀 Ahorra 2 horas semanales con nuestras rutinas de ejercicio de alta intensidad de solo 20 minutos
|
| 37 |
+
💰 Invierte menos de $2 por comida con nuestro plan de alimentación económico y nutritivo
|
| 38 |
+
😌 Disfruta de comidas deliciosas sin sentir que estás a dieta ni sufrir antojos incontrolables
|
| 39 |
+
🔄 Transforma tu relación con la comida para mantener los resultados a largo plazo sin efecto rebote"""
|
| 40 |
+
],
|
| 41 |
+
"custom_instructions": """
|
| 42 |
+
SPECIFIC INSTRUCTIONS FOR THIS FORMULA:
|
| 43 |
+
1. BULLET CREATION:
|
| 44 |
+
- Analiza profundamente la descripción del producto/servicio y la audiencia objetivo
|
| 45 |
+
- Crea exactamente 5 bullets de beneficios poderosos
|
| 46 |
+
- Cada bullet debe comenzar con un emoji relevante y apropiado
|
| 47 |
+
- Los bullets deben ser específicos, medibles y tangibles cuando sea posible
|
| 48 |
+
- Incluye números, porcentajes o estadísticas para hacerlos más convincentes
|
| 49 |
+
- Enfócate en resultados y transformaciones, no en características
|
| 50 |
+
|
| 51 |
+
2. BULLET TYPES (incluye uno de cada tipo):
|
| 52 |
+
- Un bullet enfocado en RESULTADOS (logros concretos, métricas)
|
| 53 |
+
- Un bullet enfocado en VELOCIDAD/FACILIDAD (ahorro de tiempo, simplicidad)
|
| 54 |
+
- Un bullet enfocado en DINERO/AHORRO (retorno de inversión, reducción de costos)
|
| 55 |
+
- Un bullet enfocado en TRANQUILIDAD/CONFIANZA (reducción de estrés, seguridad)
|
| 56 |
+
- Un bullet enfocado en TRANSFORMACIÓN (cambio de identidad, nuevo estado)
|
| 57 |
+
|
| 58 |
+
3. FORMATO:
|
| 59 |
+
- Cada bullet debe ocupar una sola línea
|
| 60 |
+
- Usa un emoji diferente y relevante para cada bullet
|
| 61 |
+
- Escribe cada bullet en una línea separada
|
| 62 |
+
- No uses números o viñetas adicionales, solo el emoji
|
| 63 |
+
- Asegúrate de que cada bullet sea independiente y completo por sí mismo
|
| 64 |
+
"""
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
def create_bullet_instruction(avatar_description, product_name, selected_formula_name="Beneficios con Emojis"):
|
| 69 |
+
"""
|
| 70 |
+
Creates instructions for generating bullets based on the selected formula.
|
| 71 |
+
|
| 72 |
+
Args:
|
| 73 |
+
avatar_description: Description of the target audience
|
| 74 |
+
product_name: Name of the product or service
|
| 75 |
+
selected_formula_name: Name of the formula to use (default: "Beneficios con Emojis")
|
| 76 |
+
|
| 77 |
+
Returns:
|
| 78 |
+
str: Complete instruction for generating bullets
|
| 79 |
+
"""
|
| 80 |
+
# Get the selected formula
|
| 81 |
+
selected_formula = bullet_formulas[selected_formula_name]
|
| 82 |
+
|
| 83 |
+
# Create the instruction
|
| 84 |
+
instruction = f"""
|
| 85 |
+
FORMULA TO USE:
|
| 86 |
+
{selected_formula["description"]}
|
| 87 |
+
|
| 88 |
+
{selected_formula["custom_instructions"]}
|
| 89 |
+
|
| 90 |
+
PRODUCT/SERVICE:
|
| 91 |
+
{product_name}
|
| 92 |
+
|
| 93 |
+
TARGET AUDIENCE:
|
| 94 |
+
{avatar_description}
|
| 95 |
+
|
| 96 |
+
Create 5 compelling benefit bullets following the formula structure exactly.
|
| 97 |
+
"""
|
| 98 |
+
|
| 99 |
+
# Add examples if available
|
| 100 |
+
if selected_formula.get("examples") and len(selected_formula["examples"]) > 0:
|
| 101 |
+
examples_text = "\n\n".join([f"Example {i+1}:\n{example}" for i, example in enumerate(selected_formula["examples"][:2])])
|
| 102 |
+
instruction += f"\n\nGet inspired by these examples:\n{examples_text}"
|
| 103 |
+
|
| 104 |
+
return instruction
|
bullets/generator.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import google.generativeai as genai
|
| 2 |
+
from .formulas import create_bullet_instruction
|
| 3 |
+
|
| 4 |
+
def generate_bullets(api_key, avatar_description, product_name, model_name="gemini-pro"):
|
| 5 |
+
"""
|
| 6 |
+
Generates benefit bullets for a product/service based on the target audience.
|
| 7 |
+
|
| 8 |
+
Args:
|
| 9 |
+
api_key: Google API key for Gemini
|
| 10 |
+
avatar_description: Description of the target audience
|
| 11 |
+
product_name: Name of the product or service
|
| 12 |
+
model_name: Name of the model to use
|
| 13 |
+
|
| 14 |
+
Returns:
|
| 15 |
+
str: Generated bullets
|
| 16 |
+
"""
|
| 17 |
+
# Configure the API
|
| 18 |
+
genai.configure(api_key=api_key)
|
| 19 |
+
|
| 20 |
+
# Get the model
|
| 21 |
+
model = genai.GenerativeModel(model_name)
|
| 22 |
+
|
| 23 |
+
# Create the instruction
|
| 24 |
+
instruction = create_bullet_instruction(avatar_description, product_name)
|
| 25 |
+
|
| 26 |
+
# Generate the bullets
|
| 27 |
+
response = model.generate_content(instruction)
|
| 28 |
+
|
| 29 |
+
return response.text
|