Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ from dotenv import load_dotenv
|
|
2 |
import streamlit as st
|
3 |
import os
|
4 |
import google.generativeai as genai
|
|
|
5 |
|
6 |
# Cargar las variables de entorno
|
7 |
load_dotenv()
|
@@ -327,15 +328,24 @@ IMPORTANT:
|
|
327 |
- Adapt speaking language from the audience
|
328 |
- Focus on transformative benefits"""
|
329 |
|
|
|
330 |
headlines_instruction = (
|
331 |
f"{system_prompt}\n\n"
|
332 |
f"Tu tarea es crear {number_of_headlines} titulares irresistibles diseñados para {target_audience}. "
|
333 |
f"El objetivo es capturar la atención instantáneamente y generar curiosidad sobre {product}. "
|
334 |
-
f"Evita menciones obvias de {product} y enfócate en despertar interés genuino
|
335 |
-
f"Usa
|
336 |
-
f"
|
337 |
)
|
338 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
chat_session = model.start_chat(
|
340 |
history=[
|
341 |
{
|
|
|
2 |
import streamlit as st
|
3 |
import os
|
4 |
import google.generativeai as genai
|
5 |
+
import random
|
6 |
|
7 |
# Cargar las variables de entorno
|
8 |
load_dotenv()
|
|
|
328 |
- Adapt speaking language from the audience
|
329 |
- Focus on transformative benefits"""
|
330 |
|
331 |
+
# Modificar el headlines_instruction para incluir ejemplos
|
332 |
headlines_instruction = (
|
333 |
f"{system_prompt}\n\n"
|
334 |
f"Tu tarea es crear {number_of_headlines} titulares irresistibles diseñados para {target_audience}. "
|
335 |
f"El objetivo es capturar la atención instantáneamente y generar curiosidad sobre {product}. "
|
336 |
+
f"Evita menciones obvias de {product} y enfócate en despertar interés genuino.\n\n"
|
337 |
+
f"Usa esta fórmula como guía:\n{selected_formula['description']}\n\n"
|
338 |
+
f"Inspírate en estos ejemplos de la fórmula:\n"
|
339 |
)
|
340 |
|
341 |
+
# Agregar 3 ejemplos aleatorios de la fórmula seleccionada
|
342 |
+
|
343 |
+
random_examples = random.sample(selected_formula['examples'], min(3, len(selected_formula['examples'])))
|
344 |
+
for i, example in enumerate(random_examples, 1):
|
345 |
+
headlines_instruction += f"{i}. {example}\n"
|
346 |
+
|
347 |
+
headlines_instruction += "\nCrea titulares igual de cautivadores siguiendo el mismo estilo y estructura."
|
348 |
+
|
349 |
chat_session = model.start_chat(
|
350 |
history=[
|
351 |
{
|