JeCabrera commited on
Commit
10eb1fe
·
verified ·
1 Parent(s): e32a9cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -92,22 +92,22 @@ def generate_headlines(number_of_headlines, target_audience, product, temperatur
92
  model = genai.GenerativeModel(
93
  model_name="gemini-1.5-flash",
94
  generation_config=generation_config,
95
- system_instruction="You are a world-class copywriter with experience in creating hooks, headlines, and subject lines that capture attention immediately. Your skill lies in deeply understanding the emotions, desires, and challenges of a specific audience. Generate unusual, creative, and fascinating headlines that capture readers' attention about the product. Respond in Spanish and use a numbered list format. Important: Only answer with bullets, 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.'."
96
  )
97
 
98
- chat_session = model.start_chat(
99
- history=[
100
- {
101
- "role": "user",
102
- "parts": [
103
- f"Tu tarea es crear {number_of_headlines} ganchos o encabezados titulares llamativos diseñados para {target_audience} con el fin de generar interés en {product}. "
104
- f"Usa la siguiente mención: {mention_instruction}. "
105
- "Los ganchos deben ser de este tipo: "
106
- + " ".join([", ".join(ejemplos) for ejemplos in headline_types.values()])
107
- ],
108
- },
109
- ]
110
- )
111
 
112
  response = chat_session.send_message("Genera los titulares") # Enviar mensaje para obtener la respuesta
113
  return response.text # Regresar la respuesta directamente
@@ -170,4 +170,4 @@ if submit:
170
  except ValueError as e:
171
  col2.error(f"Error: {str(e)}")
172
  else:
173
- col2.error("Por favor, proporciona el público objetivo y el producto.")
 
92
  model = genai.GenerativeModel(
93
  model_name="gemini-1.5-flash",
94
  generation_config=generation_config,
95
+ system_instruction="Eres un copywriter de clase mundial, con experiencia en la creación de ganchos, titulares y líneas de asunto que capturan la atención de inmediato. Tu habilidad radica en comprender profundamente las emociones, deseos y desafíos de una audiencia específica."
96
  )
97
 
98
+ chat_session = model.start_chat(
99
+ history=[
100
+ {
101
+ "role": "user",
102
+ "parts": [
103
+ f"Tu tarea es crear {number_of_headlines} ganchos o encabezados titulares llamativos diseñados para {target_audience} con el fin de generar interés en {product}. "
104
+ f"Usa la siguiente mención: {mention_instruction}. "
105
+ "Los ganchos deben ser de este tipo: "
106
+ + " ".join([f"{tipo}: " + ", ".join(ejemplos) for tipo, ejemplos in headline_types.items()])
107
+ ],
108
+ },
109
+ ]
110
+ )
111
 
112
  response = chat_session.send_message("Genera los titulares") # Enviar mensaje para obtener la respuesta
113
  return response.text # Regresar la respuesta directamente
 
170
  except ValueError as e:
171
  col2.error(f"Error: {str(e)}")
172
  else:
173
+ col2.error("Por favor, proporciona el público objetivo y el producto.")