Update app.py
Browse files
app.py
CHANGED
@@ -6,222 +6,230 @@ import google.generativeai as genai
|
|
6 |
load_dotenv()
|
7 |
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
8 |
|
9 |
-
system_prompt = """You are a world-class copywriter, specialized in creating persuasive and captivating stories that emotionally connect with readers and effectively convey messages.
|
10 |
-
|
11 |
-
FORMAT RULES:
|
12 |
-
- Story must follow the selected formula structure
|
13 |
-
- Use clear and well-defined paragraphs
|
14 |
-
- Maintain coherent narrative flow
|
15 |
-
- Include smooth transitions between sections
|
16 |
-
- Avoid unnecessary jargon or complex language
|
17 |
-
- Naturally weave the product and call-to-action into the narrative
|
18 |
-
- Never explicitly mention "this is the product" or "this is the call-to-action"
|
19 |
-
|
20 |
-
TONE INSTRUCTIONS:
|
21 |
-
- Selected tone must remain consistent throughout the story
|
22 |
-
- Tone modifies HOW the narrative is expressed, not its structure
|
23 |
-
- Think of tone as an "emotional layer" over the formula
|
24 |
-
- Formula provides structure, tone provides style
|
25 |
-
- Both elements must work seamlessly together
|
26 |
-
|
27 |
-
KEY ELEMENTS:
|
28 |
-
- Impactful opening that grabs attention
|
29 |
-
- Clear and progressive narrative development
|
30 |
-
- Emotional connection with target audience
|
31 |
-
- Natural integration of product/service benefits
|
32 |
-
- Subtle but effective call-to-action woven into the story
|
33 |
-
- Transformation journey that leads to the solution
|
34 |
-
|
35 |
-
STORYTELLING GUIDELINES:
|
36 |
-
- Build tension and resolution naturally
|
37 |
-
- Create relatable scenarios and characters
|
38 |
-
- Show don't tell (especially for product benefits)
|
39 |
-
- Use sensory details and emotional triggers
|
40 |
-
- Lead to the call-to-action organically
|
41 |
-
|
42 |
-
IMPORTANT:
|
43 |
-
- Each story must be unique and memorable
|
44 |
-
- Avoid clich茅s and generalities
|
45 |
-
- Maintain a credible and authentic tone
|
46 |
-
- Adapt language to target audience
|
47 |
-
- Focus on transformative benefits
|
48 |
-
- Follow formula structure while maintaining chosen tone
|
49 |
-
- Never make the product placement feel forced
|
50 |
-
- Ensure call-to-action feels like a natural next step in the story"""
|
51 |
-
|
52 |
story_formulas = {
|
53 |
"PASA": {
|
54 |
"description": """
|
55 |
-
La f贸rmula P.A.S.A. es una
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
},
|
98 |
"GHA": {
|
99 |
"description": """
|
100 |
-
La f贸rmula G.H.A.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
-
|
|
|
103 |
|
104 |
-
|
105 |
-
|
106 |
-
Yo tambi茅n pensaba que esas im谩genes eran imposibles... hasta que descubr铆 el secreto."
|
107 |
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
112 |
|
113 |
-
|
114 |
-
|
115 |
-
|
|
|
|
|
|
|
116 |
|
117 |
-
|
|
|
118 |
|
119 |
-
|
120 |
-
"El d铆a que mi espalda me traicion贸 en medio de una presentaci贸n importante,
|
121 |
-
supe que algo ten铆a que cambiar."
|
122 |
|
123 |
-
|
124 |
-
"Prob茅 de todo: medicamentos, terapias, ejercicios... Nada funcionaba a largo plazo.
|
125 |
-
La frustraci贸n me llev贸 a investigar t茅cnicas ancestrales de sanaci贸n,
|
126 |
-
donde encontr茅 una soluci贸n sorprendentemente simple."
|
127 |
|
128 |
-
|
129 |
-
"Descubre c贸mo 5 minutos diarios pueden transformar tu salud.
|
130 |
-
Prueba MindBody+ y recupera tu vitalidad naturalmente."
|
131 |
-
"""
|
132 |
-
}
|
133 |
-
}
|
134 |
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
|
139 |
-
|
140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
AUDIENCIA OBJETIVO:
|
147 |
-
{target_audience}
|
148 |
-
|
149 |
-
ESTRUCTURA P.A.S.A. (integrar de manera natural, sin mencionar expl铆citamente las secciones):
|
150 |
-
|
151 |
-
1. PROBLEMA (25% de la historia):
|
152 |
-
* Identifica y describe v铆vidamente el dolor principal de {target_audience}
|
153 |
-
* Presenta una situaci贸n problem谩tica actual y relatable
|
154 |
-
* Expone frustraciones y desaf铆os diarios espec铆ficos
|
155 |
-
* Revela miedos ocultos y preocupaciones profundas
|
156 |
-
* Describe las luchas cotidianas con detalles sensoriales
|
157 |
-
* Menciona deseos no cumplidos que resuenan con la audiencia
|
158 |
-
|
159 |
-
2. AGITACI脫N (30% de la historia):
|
160 |
-
* Profundiza en el impacto emocional del problema
|
161 |
-
* Muestra consecuencias en relaciones personales y profesionales
|
162 |
-
* Describe el costo de la inacci贸n y oportunidades perdidas
|
163 |
-
* Explora implicaciones futuras si el problema persiste
|
164 |
-
* Detalla efectos en la vida social y personal
|
165 |
-
* Presenta el "punto de quiebre" emocional
|
166 |
-
|
167 |
-
3. SOLUCI脫N (25% de la historia):
|
168 |
-
* Introduce sutilmente '{product}' como la respuesta natural
|
169 |
-
* Describe la transformaci贸n y el viaje hacia el 茅xito
|
170 |
-
* Presenta beneficios clave a trav茅s de historias de 茅xito
|
171 |
-
* Destaca la propuesta de valor 煤nica
|
172 |
-
* Menciona puntos de alivio inmediato
|
173 |
-
* Incluye elementos de prueba social sutiles
|
174 |
-
* Enfatiza ventajas a largo plazo
|
175 |
-
|
176 |
-
4. ACCI脫N (20% de la historia):
|
177 |
-
* Integra naturalmente '{action}' como siguiente paso l贸gico
|
178 |
-
* Crea sentido de urgencia sin presi贸n
|
179 |
-
* Presenta beneficios inmediatos de actuar ahora
|
180 |
-
* Incluye elementos de reversi贸n de riesgo
|
181 |
-
* Hace que la implementaci贸n parezca f谩cil y accesible
|
182 |
-
* Motiva a trav茅s de la satisfacci贸n emocional
|
183 |
-
|
184 |
-
ELEMENTOS ESTIL脥STICOS:
|
185 |
-
* Usa lenguaje sensorial y descriptivo
|
186 |
-
* Incluye di谩logo interno o pensamientos del personaje
|
187 |
-
* Crea tensi贸n narrativa y resoluci贸n
|
188 |
-
* Mant茅n un arco narrativo coherente
|
189 |
-
* Usa met谩foras y analog铆as relevantes
|
190 |
-
* Incorpora detalles espec铆ficos de la industria/contexto
|
191 |
-
|
192 |
-
TONO Y ESTILO:
|
193 |
-
* Mant茅n el tono {mood} consistente
|
194 |
-
* Usa lenguaje que resuene con {target_audience}
|
195 |
-
* Evita clich茅s y frases trilladas
|
196 |
-
* Crea una voz narrativa aut茅ntica
|
197 |
-
* Incluye elementos de storytelling modernos
|
198 |
-
* Mant茅n un ritmo din谩mico
|
199 |
-
|
200 |
-
IMPORTANTE:
|
201 |
-
* La historia debe fluir naturalmente entre secciones
|
202 |
-
* Evita mencionar expl铆citamente "problema", "agitaci贸n", "soluci贸n" o "acci贸n"
|
203 |
-
* Integra el producto y llamado a la acci贸n de manera org谩nica
|
204 |
-
* Usa ejemplos espec铆ficos y situaciones reales
|
205 |
-
* Mant茅n un balance entre emoci贸n y racionalidad
|
206 |
-
* Crea una conexi贸n emocional inmediata
|
207 |
-
"""
|
208 |
-
else:
|
209 |
-
formula_description = story_formulas[formula_type]["description"]
|
210 |
-
prompt = f"""{system_prompt}
|
211 |
-
|
212 |
-
Como experto copywriter, crea una historia persuasiva en espa帽ol de {length} palabras con un tono {mood}, siguiendo la estructura:
|
213 |
-
|
214 |
-
{formula_description}
|
215 |
-
|
216 |
-
P煤blico objetivo: {target_audience}
|
217 |
-
Producto/Servicio: {product}
|
218 |
-
Llamada a acci贸n: {action}
|
219 |
"""
|
220 |
|
221 |
-
|
222 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
|
224 |
-
response = model.generate_content([
|
225 |
if response and response.parts:
|
226 |
return response.parts[0].text.strip()
|
227 |
raise ValueError("No se pudo generar la historia")
|
|
|
6 |
load_dotenv()
|
7 |
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
story_formulas = {
|
10 |
"PASA": {
|
11 |
"description": """
|
12 |
+
La f贸rmula P.A.S.A. es una de las estructuras m谩s efectivas en copywriting, dise帽ada para crear una conexi贸n emocional profunda que lleva a la acci贸n.
|
13 |
+
|
14 |
+
TEOR脥A:
|
15 |
+
Esta f贸rmula se basa en la psicolog铆a del dolor y el alivio, siguiendo el principio de que las personas est谩n m谩s motivadas a evitar el dolor que a buscar el placer.
|
16 |
+
|
17 |
+
ESTRUCTURA:
|
18 |
+
1. Problema:
|
19 |
+
- Identifica un dolor espec铆fico y real
|
20 |
+
- Debe ser inmediatamente reconocible por la audiencia
|
21 |
+
- Se presenta desde la perspectiva del lector
|
22 |
+
- Usa lenguaje emp谩tico y comprensivo
|
23 |
+
|
24 |
+
2. Agitaci贸n:
|
25 |
+
- Profundiza en las consecuencias emocionales
|
26 |
+
- Explora ramificaciones futuras
|
27 |
+
- Aumenta la tensi贸n psicol贸gica
|
28 |
+
- Crea un punto de inflexi贸n emocional
|
29 |
+
|
30 |
+
3. Soluci贸n:
|
31 |
+
- Presenta la respuesta de forma natural
|
32 |
+
- Enfoca en beneficios transformacionales
|
33 |
+
- Construye credibilidad gradualmente
|
34 |
+
- Demuestra el cambio positivo
|
35 |
+
|
36 |
+
4. Acci贸n:
|
37 |
+
- Propone el siguiente paso l贸gico
|
38 |
+
- Minimiza la fricci贸n y resistencia
|
39 |
+
- Crea sentido de urgencia
|
40 |
+
- Ofrece garant铆as impl铆citas
|
41 |
+
""",
|
42 |
+
"examples": [
|
43 |
+
{
|
44 |
+
"title": "App de Meditaci贸n",
|
45 |
+
"target": "Profesionales estresados",
|
46 |
+
"story": """
|
47 |
+
El insomnio se hab铆a convertido en su compa帽ero m谩s fiel. Sara miraba el reloj: 3 AM, otra vez.
|
48 |
+
|
49 |
+
Los d铆as se volv铆an borrosos, su concentraci贸n desaparec铆a. Las reuniones importantes se convert铆an en una lucha por mantener los ojos abiertos, mientras su productividad se desplomaba.
|
50 |
+
|
51 |
+
Todo cambi贸 cuando descubri贸 MeditaApp. Sus ejercicios de respiraci贸n guiada y meditaciones nocturnas la ayudaron a encontrar ese interruptor mental que necesitaba para desconectar.
|
52 |
+
|
53 |
+
Descarga MeditaApp hoy y recupera tus noches. Tus primeros 7 d铆as son gratuitos, porque creemos que una noche de buen sue帽o no tiene precio.
|
54 |
+
"""
|
55 |
+
},
|
56 |
+
{
|
57 |
+
"title": "Curso de Finanzas Personales",
|
58 |
+
"target": "J贸venes profesionales",
|
59 |
+
"story": """
|
60 |
+
Cada notificaci贸n del banco le provocaba un nudo en el est贸mago. Miguel evitaba revisar su cuenta, sabiendo que los n煤meros rojos lo esperaban.
|
61 |
+
|
62 |
+
Las deudas crec铆an mientras sus sue帽os se alejaban. La idea de comprar una casa o empezar un negocio parec铆a cada vez m谩s inalcanzable, y la ansiedad financiera lo consum铆a d铆a y noche.
|
63 |
+
|
64 |
+
Entonces encontr贸 FinanzasMaster. El curso no solo le ense帽贸 a manejar su dinero, sino a construir un futuro financiero s贸lido. En seis meses, elimin贸 sus deudas y comenz贸 a ver crecer sus ahorros.
|
65 |
+
|
66 |
+
脷nete a FinanzasMaster hoy. Transforma tu relaci贸n con el dinero con nuestro programa probado de 12 semanas. Matr铆cula con 50% de descuento esta semana.
|
67 |
+
"""
|
68 |
+
}
|
69 |
+
]
|
70 |
},
|
71 |
"GHA": {
|
72 |
"description": """
|
73 |
+
La f贸rmula G.H.A. (Gancho-Historia-Acci贸n) es una estructura narrativa poderosa que utiliza el storytelling para crear conexiones emocionales y motivar a la acci贸n.
|
74 |
+
|
75 |
+
TEOR脥A:
|
76 |
+
Esta f贸rmula aprovecha el poder de las historias para captar la atenci贸n, generar empat铆a y motivar el cambio, bas谩ndose en la psicolog铆a narrativa y el poder de la identificaci贸n personal.
|
77 |
+
|
78 |
+
ESTRUCTURA:
|
79 |
+
1. Gancho:
|
80 |
+
- Abre con un elemento sorpresa o intriga
|
81 |
+
- Genera curiosidad inmediata
|
82 |
+
- Plantea una pregunta o situaci贸n provocativa
|
83 |
+
- Conecta emocionalmente desde la primera l铆nea
|
84 |
+
|
85 |
+
2. Historia:
|
86 |
+
- Desarrolla una narrativa personal o relatable
|
87 |
+
- Incluye elementos de conflicto y superaci贸n
|
88 |
+
- Mantiene la tensi贸n narrativa
|
89 |
+
- Incorpora detalles sensoriales y emocionales
|
90 |
+
|
91 |
+
3. Acci贸n:
|
92 |
+
- Surge naturalmente de la resoluci贸n
|
93 |
+
- Conecta la moraleja con la soluci贸n
|
94 |
+
- Motiva desde la inspiraci贸n
|
95 |
+
- Propone un camino claro hacia el cambio
|
96 |
+
""",
|
97 |
+
"examples": [
|
98 |
+
{
|
99 |
+
"title": "Programa de Fitness",
|
100 |
+
"target": "Personas que quieren comenzar a ejercitarse",
|
101 |
+
"story": """
|
102 |
+
"Nunca ser茅 una persona fitness", me repet铆a cada vez que ve铆a esas fotos perfectas en Instagram. Mi realidad eran 3 minutos de ejercicio y 20 de excusas.
|
103 |
+
|
104 |
+
Un d铆a, mientras sub铆a las escaleras a mi departamento, tuve que detenerme en el segundo piso, jadeando. Mi hijo de 5 a帽os me mir贸 preocupado y me pregunt贸: "驴Mami, est谩s enferma?". Ese momento cambi贸 todo.
|
105 |
+
|
106 |
+
FitLife no me prometi贸 un cuerpo de revista, me ofreci贸 algo mejor: la capacidad de jugar con mi hijo sin quedarme sin aliento. Empec茅 con 10 minutos diarios, luego 15, y ahora corremos juntos en el parque.
|
107 |
+
|
108 |
+
Comienza tu historia de transformaci贸n hoy. 脷nete a FitLife y descubre c贸mo 15 minutos pueden cambiar tu vida. Primera semana gratis, porque tu bienestar no puede esperar.
|
109 |
+
"""
|
110 |
+
}
|
111 |
+
]
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
def generate_story(formula_type, target_audience, product, action, mood, length, story_topic=None):
|
116 |
+
"""Funci贸n unificada para generar historias"""
|
117 |
+
model = genai.GenerativeModel("gemini-2.0-flash")
|
118 |
|
119 |
+
if formula_type not in story_formulas:
|
120 |
+
raise ValueError("F贸rmula no v谩lida")
|
121 |
|
122 |
+
# System prompt base
|
123 |
+
system_prompt = f"""You are a world-class copywriter, specialized in crafting persuasive stories that emotionally connect with readers and drive them to action.
|
|
|
124 |
|
125 |
+
FORMAT RULES:
|
126 |
+
- Story must be structured in clear paragraphs
|
127 |
+
- Each section must flow naturally into the next
|
128 |
+
- No explicit section labels
|
129 |
+
- Maintain consistent tone throughout
|
130 |
+
- Include smooth transitions between parts
|
131 |
+
- Story must feel complete and cohesive
|
132 |
|
133 |
+
IMPORTANT STRUCTURE INSTRUCTIONS:
|
134 |
+
- The selected formula MUST be applied to the entire story
|
135 |
+
- Review and follow the structure detailed in story_formulas[formula_type]["description"]
|
136 |
+
- Use the examples in story_formulas[formula_type]["examples"] as inspiration
|
137 |
+
- Formula provides the framework, tone provides the emotional layer
|
138 |
+
- Both must work together seamlessly
|
139 |
|
140 |
+
FORMAT EXAMPLE:
|
141 |
+
[First paragraph introducing the situation]
|
142 |
|
143 |
+
[Second paragraph developing tension/conflict]
|
|
|
|
|
144 |
|
145 |
+
[Third paragraph presenting transformation]
|
|
|
|
|
|
|
146 |
|
147 |
+
[Final paragraph with natural call to action]
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
+
IMPORTANT:
|
150 |
+
- Each story must be unique and memorable
|
151 |
+
- Avoid clich茅s and generic scenarios
|
152 |
+
- Maintain a credible and authentic voice
|
153 |
+
- Adapt language to target audience
|
154 |
+
- Focus on emotional transformation
|
155 |
+
- Follow formula structure while maintaining selected tone
|
156 |
+
- Never explicitly label sections
|
157 |
+
- Integrate product and call-to-action organically
|
158 |
+
|
159 |
+
STORY STRUCTURE GUIDELINES:
|
160 |
+
1. Study the formula description carefully
|
161 |
+
2. Review provided examples for style and flow
|
162 |
+
3. Maintain similar paragraph length and structure
|
163 |
+
4. Use consistent emotional intensity
|
164 |
+
5. Mirror the narrative progression
|
165 |
+
6. Adapt content for target audience while keeping formula essence
|
166 |
+
|
167 |
+
TONE AND STYLE:
|
168 |
+
- Selected tone must remain consistent
|
169 |
+
- Tone modifies HOW the story is told
|
170 |
+
- Formula provides structure, tone provides emotion
|
171 |
+
- Both elements must complement each other
|
172 |
+
- Maintain voice appropriate for target audience
|
173 |
+
|
174 |
+
KEY ELEMENTS TO INCLUDE:
|
175 |
+
- Emotional hooks that grab attention
|
176 |
+
- Relatable situations and characters
|
177 |
+
- Sensory details and vivid descriptions
|
178 |
+
- Natural problem-solution progression
|
179 |
+
- Organic product integration
|
180 |
+
- Compelling but subtle call-to-action"""
|
181 |
+
|
182 |
+
# Iniciar el prompt con las instrucciones del sistema
|
183 |
+
story_instruction = f"{system_prompt}\n\n"
|
184 |
+
|
185 |
+
# Agregar la descripci贸n de la f贸rmula seleccionada
|
186 |
+
story_instruction += f"""
|
187 |
+
SELECTED FORMULA STRUCTURE:
|
188 |
+
{story_formulas[formula_type]['description']}
|
189 |
+
|
190 |
+
SUCCESSFUL EXAMPLES OF THIS FORMULA:
|
191 |
+
"""
|
192 |
|
193 |
+
# Agregar ejemplos de la f贸rmula
|
194 |
+
for example in story_formulas[formula_type]['examples']:
|
195 |
+
story_instruction += f"""
|
196 |
+
TITLE: {example['title']}
|
197 |
+
TARGET: {example['target']}
|
198 |
+
STORY:
|
199 |
+
{example['story']}
|
200 |
+
"""
|
201 |
+
|
202 |
+
# Agregar instrucciones espec铆ficas para la generaci贸n
|
203 |
+
story_instruction += f"""
|
204 |
+
YOUR TASK:
|
205 |
+
Create a compelling {length}-word story in Spanish with a {mood} tone for {target_audience} about {product} that leads to this action: {action}.
|
206 |
+
|
207 |
+
SPECIFIC REQUIREMENTS:
|
208 |
+
1. Follow the formula structure exactly as shown in the description
|
209 |
+
2. Maintain the {mood} tone throughout the story
|
210 |
+
3. Write for {target_audience} using appropriate language and references
|
211 |
+
4. Integrate {product} naturally into the narrative
|
212 |
+
5. Lead to the call-to-action: {action}
|
213 |
+
"""
|
214 |
|
215 |
+
# Agregar instrucciones espec铆ficas para GHA si aplica
|
216 |
+
if formula_type == "GHA" and story_topic:
|
217 |
+
story_instruction += f"""
|
218 |
+
6. Incorporate this specific story topic: {story_topic}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
"""
|
220 |
|
221 |
+
story_instruction += """
|
222 |
+
FINAL REMINDERS:
|
223 |
+
1. Write in clear, engaging Spanish
|
224 |
+
2. Use proper paragraph structure
|
225 |
+
3. Maintain narrative flow
|
226 |
+
4. Create emotional connection
|
227 |
+
5. Make call-to-action feel natural
|
228 |
+
|
229 |
+
Generate the story now:
|
230 |
+
"""
|
231 |
|
232 |
+
response = model.generate_content([story_instruction])
|
233 |
if response and response.parts:
|
234 |
return response.parts[0].text.strip()
|
235 |
raise ValueError("No se pudo generar la historia")
|