Spaces:
Sleeping
Sleeping
Update formulas.py
Browse files- formulas.py +53 -0
formulas.py
CHANGED
|
@@ -1,3 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
offer_formulas = {
|
| 2 |
"F贸rmula Sue帽o-Obst谩culo": {
|
| 3 |
"description": """
|
|
|
|
| 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 |
+
# Create the instruction
|
| 27 |
+
instruction = f"""
|
| 28 |
+
You are a world-class expert copywriter, experienced in creating compelling offers that connect emotionally with the target audience.
|
| 29 |
+
|
| 30 |
+
OBJECTIVE:
|
| 31 |
+
- Generate a convincing offer in Spanish using the {selected_formula_name}
|
| 32 |
+
- Connect emotionally with the audience: {avatar_description}
|
| 33 |
+
- Address real desires, problems, and motivations
|
| 34 |
+
- Maintain natural and conversational language
|
| 35 |
+
|
| 36 |
+
FORMULA TO USE:
|
| 37 |
+
{selected_formula["description"]}
|
| 38 |
+
|
| 39 |
+
EXAMPLES (Use these as inspiration but create something unique):
|
| 40 |
+
{examples_text}
|
| 41 |
+
|
| 42 |
+
PRODUCT/SERVICE:
|
| 43 |
+
{product_name}
|
| 44 |
+
|
| 45 |
+
TARGET AUDIENCE:
|
| 46 |
+
{avatar_description}
|
| 47 |
+
|
| 48 |
+
Create a compelling offer following the formula structure exactly.
|
| 49 |
+
"""
|
| 50 |
+
|
| 51 |
+
return instruction
|
| 52 |
+
|
| 53 |
+
# The rest of your offer_formulas dictionary remains unchanged
|
| 54 |
offer_formulas = {
|
| 55 |
"F贸rmula Sue帽o-Obst谩culo": {
|
| 56 |
"description": """
|