Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,8 +29,8 @@ bullets_examples = {
|
|
| 29 |
def get_gemini_response_bullets(target_audience, product, num_bullets, temperature):
|
| 30 |
model_choice = "gemini-1.5-flash" # Modelo por defecto
|
| 31 |
|
| 32 |
-
# Seleccionar
|
| 33 |
-
|
| 34 |
|
| 35 |
# Configuración del modelo generativo y las instrucciones del sistema
|
| 36 |
model = genai.GenerativeModel(
|
|
@@ -61,7 +61,7 @@ def get_gemini_response_bullets(target_audience, product, num_bullets, temperatu
|
|
| 61 |
f"Un buen bullet conecta los síntomas con los problemas enfrentados por {target_audience} de una manera natural, que no se note como manipuladora."
|
| 62 |
f"Escribe bullets creativos, en un estilo conversacional, que no sean aburridos, sino más bien divertidos. "
|
| 63 |
f"Sé sutil a la hora de crear los bullets para referirte a los beneficios del {product}. "
|
| 64 |
-
f"Usa
|
| 65 |
"1. **Connection**: Words that highlight the relationship between the product and the benefit for the user (e.g., 'Improve,' 'Transform').\n"
|
| 66 |
"2. **Benefit**: Explain how the user will benefit by attending, downloading, or purchasing the product.\n\n"
|
| 67 |
"Ensure each bullet follows the structure of 'Connection + connector + Benefit,' and avoid including explanations like 'Connection: Improve' or 'Benefit: Increase my happiness.'\n"
|
|
@@ -69,7 +69,7 @@ def get_gemini_response_bullets(target_audience, product, num_bullets, temperatu
|
|
| 69 |
"Use these guidelines to generate high-converting bullets in Spanish."
|
| 70 |
"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.' "
|
| 71 |
"Bullets should vary, based on these examples to guide your task of creating bullets:\n\n"
|
| 72 |
-
f"* {
|
| 73 |
# Añadir más ejemplos si es necesario
|
| 74 |
"Por favor, crea los bullets ahora."
|
| 75 |
],
|
|
@@ -124,7 +124,7 @@ with col1:
|
|
| 124 |
product = st.text_input("¿Qué producto tienes en mente?")
|
| 125 |
|
| 126 |
# Campos de personalización sin acordeón
|
| 127 |
-
num_bullets = st.slider("Número de Bullets", min_value=1, max_value=
|
| 128 |
temperature = st.slider("Creatividad", min_value=0.0, max_value=1.0, value=0.5, step=0.1)
|
| 129 |
|
| 130 |
# Botón de enviar
|
|
|
|
| 29 |
def get_gemini_response_bullets(target_audience, product, num_bullets, temperature):
|
| 30 |
model_choice = "gemini-1.5-flash" # Modelo por defecto
|
| 31 |
|
| 32 |
+
# Seleccionar múltiples bullets aleatorios de los ejemplos
|
| 33 |
+
selected_bullets = random.sample(list(bullets_examples.values()), min(num_bullets, len(bullets_examples)))
|
| 34 |
|
| 35 |
# Configuración del modelo generativo y las instrucciones del sistema
|
| 36 |
model = genai.GenerativeModel(
|
|
|
|
| 61 |
f"Un buen bullet conecta los síntomas con los problemas enfrentados por {target_audience} de una manera natural, que no se note como manipuladora."
|
| 62 |
f"Escribe bullets creativos, en un estilo conversacional, que no sean aburridos, sino más bien divertidos. "
|
| 63 |
f"Sé sutil a la hora de crear los bullets para referirte a los beneficios del {product}. "
|
| 64 |
+
f"Usa estos ejemplos como inspiración: {', '.join(selected_bullets)}." # Añadir bullets aleatorios
|
| 65 |
"1. **Connection**: Words that highlight the relationship between the product and the benefit for the user (e.g., 'Improve,' 'Transform').\n"
|
| 66 |
"2. **Benefit**: Explain how the user will benefit by attending, downloading, or purchasing the product.\n\n"
|
| 67 |
"Ensure each bullet follows the structure of 'Connection + connector + Benefit,' and avoid including explanations like 'Connection: Improve' or 'Benefit: Increase my happiness.'\n"
|
|
|
|
| 69 |
"Use these guidelines to generate high-converting bullets in Spanish."
|
| 70 |
"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.' "
|
| 71 |
"Bullets should vary, based on these examples to guide your task of creating bullets:\n\n"
|
| 72 |
+
f"* {', '.join(selected_bullets)} "
|
| 73 |
# Añadir más ejemplos si es necesario
|
| 74 |
"Por favor, crea los bullets ahora."
|
| 75 |
],
|
|
|
|
| 124 |
product = st.text_input("¿Qué producto tienes en mente?")
|
| 125 |
|
| 126 |
# Campos de personalización sin acordeón
|
| 127 |
+
num_bullets = st.slider("Número de Bullets", min_value=1, max_value=10, value=5)
|
| 128 |
temperature = st.slider("Creatividad", min_value=0.0, max_value=1.0, value=0.5, step=0.1)
|
| 129 |
|
| 130 |
# Botón de enviar
|