Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -26,7 +26,7 @@ def get_random_product_mention():
|
|
26 |
|
27 |
# Crear la instrucci贸n de menci贸n basada en la opci贸n seleccionada
|
28 |
def get_mention_instruction(product_mention, product):
|
29 |
-
mention_descriptions =
|
30 |
examples = {
|
31 |
"Directa": [
|
32 |
f"Este curso de ingl茅s te proporcionar谩 las herramientas necesarias para abrir nuevas oportunidades laborales.",
|
@@ -46,13 +46,14 @@ def get_mention_instruction(product_mention, product):
|
|
46 |
]
|
47 |
}
|
48 |
|
|
|
49 |
return f"{mention_descriptions[product_mention]} Ejemplos: {', '.join(examples[product_mention])}"
|
50 |
|
51 |
-
#
|
52 |
-
def get_random_mention_instruction():
|
53 |
-
mention_type = get_random_product_mention() #
|
54 |
-
|
55 |
-
return
|
56 |
|
57 |
# Funci贸n para obtener una cantidad de bullets
|
58 |
def generate_bullets(number_of_bullets, target_audience, product, temperature):
|
@@ -67,7 +68,7 @@ def generate_bullets(number_of_bullets, target_audience, product, temperature):
|
|
67 |
You are a world-class copywriter, expert in creating benefits that connect symptoms with problems of {target_audience}. You deeply understand the emotions, desires, and challenges of {target_audience}, allowing you to design personalized copywriting that resonate and motivate action. You know how to use proven structures to attract your {target_audience}, generating interest and creating a powerful connection with {product}.
|
68 |
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.'.
|
69 |
Your task is to create benefits or bullets that connect the symptom with the problem faced by {target_audience}, increasing their desire to acquire the {product}.
|
70 |
-
Infuse your responses with a creativity level that aligns with the specified temperature of {
|
71 |
* 'The bathroom cabinet is the best place to store medicine, right? Incorrect. It's the worst. The facts are on page 10.'
|
72 |
* 'The best verb tense that gives your clients the feeling they've already bought from you.'
|
73 |
* 'The story of...', 'The mysteries of...', 'The legend of...'
|
@@ -85,7 +86,7 @@ def generate_bullets(number_of_bullets, target_audience, product, temperature):
|
|
85 |
|
86 |
# Crear el prompt para generar bullets
|
87 |
full_prompt = f"""
|
88 |
-
Write {
|
89 |
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:'
|
90 |
Please create the bullets now.
|
91 |
"""
|
@@ -145,7 +146,7 @@ with col1:
|
|
145 |
|
146 |
# Campos de personalizaci贸n sin acorde贸n
|
147 |
num_bullets = st.slider("N煤mero de Bullets", min_value=1, max_value=10, value=5)
|
148 |
-
|
149 |
|
150 |
# Bot贸n de enviar
|
151 |
submit = st.button("Generar Bullets")
|
@@ -155,7 +156,7 @@ if submit:
|
|
155 |
if target_audience and product:
|
156 |
try:
|
157 |
# Obtener la respuesta del modelo
|
158 |
-
generated_bullets = generate_bullets(
|
159 |
col2.markdown(f"""
|
160 |
<div style="border: 1px solid #000000; padding: 5px; border-radius: 8px; background-color: #ffffff;">
|
161 |
<h4>Observa la magia en acci贸n:</h4>
|
|
|
26 |
|
27 |
# Crear la instrucci贸n de menci贸n basada en la opci贸n seleccionada
|
28 |
def get_mention_instruction(product_mention, product):
|
29 |
+
mention_descriptions = mention_descriptions(product) # Llamar la funci贸n con el producto
|
30 |
examples = {
|
31 |
"Directa": [
|
32 |
f"Este curso de ingl茅s te proporcionar谩 las herramientas necesarias para abrir nuevas oportunidades laborales.",
|
|
|
46 |
]
|
47 |
}
|
48 |
|
49 |
+
# Retornar la descripci贸n de la menci贸n seleccionada junto con ejemplos
|
50 |
return f"{mention_descriptions[product_mention]} Ejemplos: {', '.join(examples[product_mention])}"
|
51 |
|
52 |
+
# Funci贸n que obtiene una instrucci贸n aleatoria de menci贸n
|
53 |
+
def get_random_mention_instruction(product):
|
54 |
+
mention_type = get_random_product_mention() # Obtener tipo de menci贸n aleatoria
|
55 |
+
mention_instruction = get_mention_instruction(mention_type, product) # Obtener instrucci贸n con base en el producto y tipo de menci贸n
|
56 |
+
return mention_instruction
|
57 |
|
58 |
# Funci贸n para obtener una cantidad de bullets
|
59 |
def generate_bullets(number_of_bullets, target_audience, product, temperature):
|
|
|
68 |
You are a world-class copywriter, expert in creating benefits that connect symptoms with problems of {target_audience}. You deeply understand the emotions, desires, and challenges of {target_audience}, allowing you to design personalized copywriting that resonate and motivate action. You know how to use proven structures to attract your {target_audience}, generating interest and creating a powerful connection with {product}.
|
69 |
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.'.
|
70 |
Your task is to create benefits or bullets that connect the symptom with the problem faced by {target_audience}, increasing their desire to acquire the {product}.
|
71 |
+
Infuse your responses with a creativity level that aligns with the specified temperature of {temperature}, leveraging the imaginative capabilities of the Gemini 1.5 Flash model to produce innovative and boundary-pushing ideas. The bullets should be of the following types:
|
72 |
* 'The bathroom cabinet is the best place to store medicine, right? Incorrect. It's the worst. The facts are on page 10.'
|
73 |
* 'The best verb tense that gives your clients the feeling they've already bought from you.'
|
74 |
* 'The story of...', 'The mysteries of...', 'The legend of...'
|
|
|
86 |
|
87 |
# Crear el prompt para generar bullets
|
88 |
full_prompt = f"""
|
89 |
+
Write {number_of_bullets} unusual, creative, and fascinating bullets that capturing readers' attention.
|
90 |
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:'
|
91 |
Please create the bullets now.
|
92 |
"""
|
|
|
146 |
|
147 |
# Campos de personalizaci贸n sin acorde贸n
|
148 |
num_bullets = st.slider("N煤mero de Bullets", min_value=1, max_value=10, value=5)
|
149 |
+
tempeture = st.selectbox("Creatividad", ["Alta", "Media", "Baja"])
|
150 |
|
151 |
# Bot贸n de enviar
|
152 |
submit = st.button("Generar Bullets")
|
|
|
156 |
if target_audience and product:
|
157 |
try:
|
158 |
# Obtener la respuesta del modelo
|
159 |
+
generated_bullets = generate_bullets(number_of_bullets, target_audience, product, tempeture)
|
160 |
col2.markdown(f"""
|
161 |
<div style="border: 1px solid #000000; padding: 5px; border-radius: 8px; background-color: #ffffff;">
|
162 |
<h4>Observa la magia en acci贸n:</h4>
|