Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -38,79 +38,43 @@ def get_gemini_response_bullets(target_audience, product, num_bullets, creativit
|
|
38 |
mention_instruction = get_mention_instruction(product_mention, product) # Define aquí
|
39 |
model_choice = "gemini-1.5-flash" # Modelo por defecto
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
)
|
67 |
-
)
|
68 |
-
|
69 |
-
# Crear el prompt para generar bullets
|
70 |
-
bullets_instruction = (
|
71 |
-
f"Tu tarea es escribir {num_bullets} beneficios o bullets que conecten el síntoma con el problema enfrentado por {target_audience}, "
|
72 |
-
f"aumentando su deseo de adquirir, asistir, descargar o comprar el {product}. "
|
73 |
-
f"Escribe los bullets con un nivel de creatividad {creativity}. "
|
74 |
-
"Asegúrate de que la mención se adapte según este tipo: "
|
75 |
-
"Por favor, crea los bullets ahora."
|
76 |
-
)
|
77 |
-
|
78 |
-
# Selección aleatoria de tipos de mención, manteniendo variedad en la salida
|
79 |
-
product_mention = get_random_product_mention()
|
80 |
-
|
81 |
-
# Crear un mensaje para el modelo que incluye los bullets generados según los tipos seleccionados
|
82 |
-
full_prompt = f"{system_instruction}\n{bullets_instruction}"
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
# System Prompt - Instrucción en inglés para el modelo
|
88 |
-
system_instruction = """
|
89 |
-
You are a world-class copywriter, expert in creating benefits that connect symptoms with problems. You deeply understand the emotions, desires, and challenges of a specific audience, allowing you to design personalized marketing strategies that resonate and motivate action. You know how to use proven structures to attract your target audience, generating interest and creating a powerful connection.
|
90 |
-
Generate unusual, creative, and fascinating bullets that subtly hint at the product without direct mention, capturing readers' attention. Respond in Spanish and use a numbered list format. Important: Never include explanations or categories, like this: 'La leyenda del padre soltero: Dice que nunca hay tiempo suficiente. El yoga te enseña a usar mejor el tiempo que tienes, incluso cuando te parece imposible.'.
|
91 |
-
"""
|
92 |
|
93 |
# Crear el prompt para generar bullets
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
* 'When is it a good idea to tell a girl you like her? If you don't say it at that moment, say goodbye to getting to know her intimately.'
|
105 |
-
Using {mention_instruction} when you want to mention {product}.
|
106 |
-
Use the following mention instructions to guide your writing: {mention_instruction}
|
107 |
-
Using the mention type '{product_mention}' to guide how to mention the product in the benefits or bullets. Ensure the mention is adapted based on this type:
|
108 |
-
- Direct: Clearly highlight the product as the solution.
|
109 |
-
- Indirect: Subtly suggest the product without naming it.
|
110 |
-
- Metaphorical: Use a metaphor to connect the product to the solution.
|
111 |
-
When responding, always include a headline that references the {target_audience} and the product in the following way: 'Aquí tienes 5 bullets para Papás solteros, que aumenten el deseo de adquirir el Aceite multigrado, usando la mención indirecta:'
|
112 |
-
Please create the bullets now.
|
113 |
-
"""
|
114 |
|
115 |
response = model.generate_content([full_prompt])
|
116 |
|
|
|
38 |
mention_instruction = get_mention_instruction(product_mention, product) # Define aquí
|
39 |
model_choice = "gemini-1.5-flash" # Modelo por defecto
|
40 |
|
41 |
+
# Configuración del modelo generativo y las instrucciones del sistema
|
42 |
+
model = genai.GenerativeModel(
|
43 |
+
model_name=model_choice, # Nombre del modelo que estamos utilizando
|
44 |
+
generation_config=None, # Configuración de generación, ajusta según sea necesario
|
45 |
+
system_instruction=(
|
46 |
+
f"You are a world-class copywriter, expert in creating benefits that connect symptoms with problems of {target_audience}. "
|
47 |
+
f"You deeply understand the emotions, desires, and challenges of {target_audience}, allowing you to design personalized copywriting that resonate and motivate action. "
|
48 |
+
f"You know how to use proven structures to attract {target_audience}, generating interest and creating a powerful connection with {product}. "
|
49 |
+
"Generate unusual, creative, and fascinating bullets that capturing {target_audience}'s attention. Respond in Spanish and use a numbered list format. "
|
50 |
+
"Important: Never include explanations or categories, like this: 'La leyenda del padre soltero: Dice que nunca hay tiempo suficiente. El yoga te enseña a usar mejor el tiempo que tienes, incluso cuando te parece imposible.' "
|
51 |
+
"Los bullets deben ser de los siguientes tipos: "
|
52 |
+
"* 'El armario del baño es el mejor lugar para guardar medicamentos, ¿verdad? Incorrecto. Es el peor. Los hechos están en la página 10.' "
|
53 |
+
"* 'El mejor tiempo verbal que le da a tus clientes la sensación de que ya te han comprado.' "
|
54 |
+
"* 'La historia de...', 'Los misterios de...', 'La leyenda de...' "
|
55 |
+
"* 'Un sistema simple para escribir textos sin intentar convencerlos de comprar.' "
|
56 |
+
"* Verdad: 'La verdad que nunca te han contado en la escuela, o en casa, sobre cómo ganarte la vida con la música.' "
|
57 |
+
"* '¿Sabías que...' "
|
58 |
+
"* '¿Cuándo es una buena idea decirle a una chica que te gusta? Si no se lo dices en ese momento, despídete de conocerla íntimamente.' "
|
59 |
+
f"Usando {mention_instruction} cuando desees mencionar {product}. "
|
60 |
+
f"Usa las siguientes instrucciones de mención para guiar tu escritura: {mention_instruction} "
|
61 |
+
f"Usando el tipo de mención '{product_mention}' para guiar cómo mencionar el producto en los beneficios o bullets. "
|
62 |
+
f"Al responder, siempre incluye un encabezado que haga referencia a {target_audience} y el producto de la siguiente manera: "
|
63 |
+
f"'Aquí tienes 5 bullets para {target_audience}, que aumenten el deseo de adquirir el {product}, usando la mención indirecta:' "
|
64 |
+
)
|
65 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
# Crear el prompt para generar bullets
|
68 |
+
bullets_instruction = (
|
69 |
+
f"Tu tarea es escribir {num_bullets} beneficios o bullets que conecten el síntoma con el problema enfrentado por {target_audience}, "
|
70 |
+
f"aumentando su deseo de adquirir, asistir, descargar o comprar el {product}. "
|
71 |
+
f"Escribe los bullets con un nivel de creatividad {creativity}. "
|
72 |
+
"Asegúrate de que la mención se adapte según este tipo: "
|
73 |
+
"Por favor, crea los bullets ahora."
|
74 |
+
)
|
75 |
+
|
76 |
+
# Crear un mensaje para el modelo que incluye los bullets generados según los tipos seleccionados
|
77 |
+
full_prompt = f"{bullets_instruction}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
response = model.generate_content([full_prompt])
|
80 |
|