Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -185,23 +185,22 @@ headline_formulas = {
|
|
185 |
}
|
186 |
}
|
187 |
|
188 |
-
# Función para generar titulares
|
189 |
def generate_headlines(number_of_headlines, target_audience, product, temperature, selected_formula):
|
190 |
-
|
191 |
# Crear la configuración del modelo
|
192 |
generation_config = {
|
193 |
-
"temperature": temperature,
|
194 |
-
"top_p": 0.65,
|
195 |
-
"top_k": 360,
|
196 |
-
"max_output_tokens": 8196,
|
197 |
}
|
198 |
|
199 |
model = genai.GenerativeModel(
|
200 |
model_name="gemini-2.0-flash",
|
201 |
generation_config=generation_config,
|
202 |
-
)
|
203 |
-
|
204 |
-
|
|
|
205 |
|
206 |
OBJECTIVE:
|
207 |
- Generate persuasive and specific headlines in Spanish
|
@@ -239,7 +238,6 @@ IMPORTANT:
|
|
239 |
- Adapt language to the audience
|
240 |
- Focus on transformative benefits"""
|
241 |
|
242 |
-
# Crear un mensaje para el modelo
|
243 |
headlines_instruction = (
|
244 |
f"{system_prompt}\n\n"
|
245 |
f"Tu tarea es crear {number_of_headlines} titulares irresistibles diseñados para {target_audience}. "
|
@@ -253,7 +251,6 @@ IMPORTANT:
|
|
253 |
f"Tu objetivo es crear titulares tan intrigantes que sea imposible no seguir leyendo."
|
254 |
)
|
255 |
|
256 |
-
# Crear la sesión de chat
|
257 |
chat_session = model.start_chat(
|
258 |
history=[
|
259 |
{
|
@@ -264,7 +261,7 @@ IMPORTANT:
|
|
264 |
)
|
265 |
|
266 |
response = chat_session.send_message("Genera los titulares")
|
267 |
-
return response.text
|
268 |
|
269 |
# Configurar la interfaz de usuario con Streamlit
|
270 |
st.set_page_config(page_title="Enchanted Hooks", layout="wide")
|
|
|
185 |
}
|
186 |
}
|
187 |
|
|
|
188 |
def generate_headlines(number_of_headlines, target_audience, product, temperature, selected_formula):
|
|
|
189 |
# Crear la configuración del modelo
|
190 |
generation_config = {
|
191 |
+
"temperature": temperature,
|
192 |
+
"top_p": 0.65,
|
193 |
+
"top_k": 360,
|
194 |
+
"max_output_tokens": 8196,
|
195 |
}
|
196 |
|
197 |
model = genai.GenerativeModel(
|
198 |
model_name="gemini-2.0-flash",
|
199 |
generation_config=generation_config,
|
200 |
+
)
|
201 |
+
|
202 |
+
# Incluir las instrucciones del sistema en el prompt principal
|
203 |
+
system_prompt = """You are a world-class copywriter, with expertise in crafting hooks, headlines, and subject lines that immediately capture the reader's attention, prompting them to open the email or continue reading.
|
204 |
|
205 |
OBJECTIVE:
|
206 |
- Generate persuasive and specific headlines in Spanish
|
|
|
238 |
- Adapt language to the audience
|
239 |
- Focus on transformative benefits"""
|
240 |
|
|
|
241 |
headlines_instruction = (
|
242 |
f"{system_prompt}\n\n"
|
243 |
f"Tu tarea es crear {number_of_headlines} titulares irresistibles diseñados para {target_audience}. "
|
|
|
251 |
f"Tu objetivo es crear titulares tan intrigantes que sea imposible no seguir leyendo."
|
252 |
)
|
253 |
|
|
|
254 |
chat_session = model.start_chat(
|
255 |
history=[
|
256 |
{
|
|
|
261 |
)
|
262 |
|
263 |
response = chat_session.send_message("Genera los titulares")
|
264 |
+
return response.text
|
265 |
|
266 |
# Configurar la interfaz de usuario con Streamlit
|
267 |
st.set_page_config(page_title="Enchanted Hooks", layout="wide")
|