JeCabrera commited on
Commit
abf47f6
·
verified ·
1 Parent(s): 268f28a

Upload 12 files

Browse files
Files changed (2) hide show
  1. app.py +541 -539
  2. styles/styles.css +98 -98
app.py CHANGED
@@ -1,540 +1,542 @@
1
- from dotenv import load_dotenv
2
- import streamlit as st
3
- import os
4
- import google.generativeai as genai
5
- import random
6
- import datetime
7
- from streamlit import session_state as state
8
- from formulas.webinar_formulas import webinar_formulas
9
- from formulas.webinar_name_formulas import webinar_name_formulas
10
- from formulas.angles_webinar_names import angles_webinar_names
11
-
12
- # Cargar las variables de entorno
13
- load_dotenv()
14
-
15
- # Configurar la API de Google
16
- genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
17
-
18
- # Función auxiliar para mostrar el contenido generado y los botones de descarga
19
- def display_generated_content(col, generated_content, content_type):
20
- timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
21
-
22
- # Determinar el tipo de contenido para personalizar los botones y títulos
23
- if content_type == "script":
24
- download_label = "DESCARGAR GUIÓN DE WEBINAR ▶▶"
25
- file_name = f"guion_webinar_{timestamp}.txt"
26
- subheader_text = "Tu guión de webinar:"
27
-
28
- # Mostrar botón de descarga superior para guiones
29
- col.download_button(
30
- label=download_label,
31
- data=generated_content,
32
- file_name=file_name,
33
- mime="text/plain",
34
- key=f"download_top_{content_type}"
35
- )
36
-
37
- # Mostrar el contenido generado
38
- col.subheader(subheader_text)
39
- col.markdown(generated_content)
40
-
41
- # Mostrar botón de descarga inferior
42
- col.download_button(
43
- label=download_label,
44
- data=generated_content,
45
- file_name=file_name,
46
- mime="text/plain",
47
- key=f"download_bottom_{content_type}"
48
- )
49
- else: # nombres
50
- subheader_text = "Tus nombres de webinar:"
51
- file_name = f"nombres_webinar_{timestamp}.txt"
52
- download_label = "DESCARGAR NOMBRES DE WEBINAR ▶▶"
53
-
54
- # Contar el número de nombres generados (aproximadamente por el número de líneas)
55
- num_names = len([line for line in generated_content.split('\n') if line.strip().startswith(('1.', '2.', '3.', '4.', '5.', '6.', '7.', '8.', '9.', '10.', '11.', '12.', '13.', '14.', '15.'))])
56
-
57
- # Determinar si hay más de 5 nombres para mostrar los botones de descarga
58
- has_many_items = num_names > 5
59
-
60
- # Para los nombres, NO usamos un contenedor div personalizado
61
- # Simplemente mostramos el botón de descarga superior si hay muchos nombres
62
- if has_many_items:
63
- col.download_button(
64
- label=download_label,
65
- data=generated_content,
66
- file_name=file_name,
67
- mime="text/plain",
68
- key=f"download_top_names",
69
- help="Descargar todos los nombres generados"
70
- )
71
-
72
- # Mostrar el contenido generado
73
- col.subheader(subheader_text)
74
- col.markdown(generated_content)
75
-
76
- # Mostrar botón de descarga inferior solo si hay más de 5 nombres
77
- if has_many_items:
78
- col.download_button(
79
- label=download_label,
80
- data=generated_content,
81
- file_name=file_name,
82
- mime="text/plain",
83
- key=f"download_bottom_names",
84
- help="Descargar todos los nombres generados"
85
- )
86
-
87
- # Implementar la función generate_and_display para reemplazar código duplicado
88
- def generate_and_display(col, generator_func, audience, product, temperature, selected_formula, content_type, **kwargs):
89
- if validate_inputs(audience, product):
90
- try:
91
- with col:
92
- with st.spinner(f"Generando {'guión' if content_type == 'script' else 'nombres'} de webinar...", show_time=True):
93
- # Llamar a la función generadora con los parámetros adecuados
94
- generated_content = generator_func(
95
- audience=audience,
96
- topic=product,
97
- temperature=temperature,
98
- selected_formula=selected_formula,
99
- **kwargs
100
- )
101
-
102
- # Mostrar el contenido generado usando la función auxiliar
103
- display_generated_content(col, generated_content, content_type)
104
-
105
- except ValueError as e:
106
- col.error(f"Error: {str(e)}")
107
- else:
108
- col.error("Por favor, proporciona el público objetivo y el tema del webinar.")
109
-
110
- # Función para crear la configuración del modelo (evita duplicación)
111
- def create_model_config(temperature):
112
- return {
113
- "temperature": temperature,
114
- "top_p": 0.65,
115
- "top_k": 360,
116
- "max_output_tokens": 8196,
117
- }
118
-
119
- # Función para inicializar el modelo
120
- def initialize_model(temperature):
121
- config = create_model_config(temperature)
122
- return genai.GenerativeModel(
123
- model_name="gemini-2.0-flash",
124
- generation_config=config,
125
- )
126
-
127
- # Refactored model interaction function to reduce duplication
128
- def generate_content(prompt_instructions, temperature):
129
- model = initialize_model(temperature)
130
- chat_session = model.start_chat(
131
- history=[
132
- {
133
- "role": "user",
134
- "parts": [prompt_instructions],
135
- },
136
- ]
137
- )
138
- response = chat_session.send_message("Generate the content following exactly the provided instructions. All content must be in Spanish.")
139
- return response.text
140
-
141
- # Función para generar nombres de webinars
142
- # Refactorizar la función generate_webinar_names para que acepte los mismos parámetros que generate_webinar_script
143
- def generate_webinar_names(audience, topic, temperature, selected_formula, number_of_names=5, selected_angle=None, **kwargs):
144
- # Incluir las instrucciones del sistema en el prompt principal
145
- system_prompt = """You are a world-class copywriter, with expertise in crafting compelling and disruptive webinar titles that immediately capture the audience's attention and drive registrations.
146
-
147
- FORMAT RULES:
148
- - Each webinar name must start with number and period
149
- - One webinar name per line
150
- - No explanations or categories
151
- - Add a line break between each name
152
- - Avoid unnecessary : symbols
153
- - Each webinar name must be a complete, intriguing and creative title
154
- - WRITE ALL WEBINAR NAMES IN SPANISH
155
-
156
- FORMAT EXAMPLE:
157
- 1. Nombre del Webinar 1.
158
-
159
- 2. Nombre del Webinar 2.
160
-
161
- 3. Nombre del Webinar 3.
162
-
163
- 4. Nombre del Webinar 4.
164
-
165
- 5. Nombre del Webinar 5.
166
-
167
- IMPORTANT:
168
- - Each webinar name must be unique, memorable and disruptive
169
- - Create curiosity and intrigue with unexpected combinations
170
- - Use creative language that stands out from typical webinar titles
171
- - Incorporate pattern interrupts that make people stop scrolling
172
- - Adapt speaking language from the audience
173
- - Focus on transformative benefits with creative angles
174
- - Follow the selected formula structure but add creative twists
175
- - WRITE ALL WEBINAR NAMES IN SPANISH"""
176
-
177
- # Iniciar el prompt con las instrucciones del sistema
178
- webinar_names_instruction = f"{system_prompt}\n\n"
179
-
180
- # Añadir instrucciones de ángulo solo si no es "NINGUNO" y se proporcionó un ángulo
181
- if selected_angle and selected_angle != "NINGUNO":
182
- webinar_names_instruction += f"""
183
- MAIN ANGLE: {selected_angle}
184
- SPECIFIC ANGLE INSTRUCTIONS:
185
- {angles_webinar_names[selected_angle]["instruction"]}
186
-
187
- IMPORTANT: The {selected_angle} angle should be applied as a "style layer" over the formula structure:
188
- 1. Keep the base structure of the formula intact
189
- 2. Apply the tone and style of the {selected_angle} angle
190
- 3. Ensure that each element of the formula reflects the angle
191
- 4. The angle affects "how" it is said, not "what" is said
192
-
193
- SUCCESSFUL EXAMPLES OF THE {selected_angle} ANGLE:
194
- """
195
- for example in angles_webinar_names[selected_angle]["examples"]:
196
- webinar_names_instruction += f"- {example}\n"
197
-
198
- # Instrucciones específicas para la tarea
199
- webinar_names_instruction += (
200
- f"\nYour task is to create {number_of_names} irresistible, creative and disruptive webinar names for {audience} "
201
- f"that instantly capture attention and generate registrations for a webinar about {topic}. "
202
- f"Focus on awakening genuine curiosity, creating intrigue, and communicating the value they will get by registering."
203
- f"\n\n"
204
- f"IMPORTANT: Use these examples of the selected formula as inspiration, but make your titles more creative and disruptive. "
205
- f"Each example represents a base structure to follow, but add unexpected elements and creative twists"
206
- f":\n\n"
207
- )
208
-
209
- # Agregar ejemplos aleatorios de la fórmula (keeping examples in Spanish)
210
- random_examples = random.sample(selected_formula['examples'], min(5, len(selected_formula['examples'])))
211
- webinar_names_instruction += "EXAMPLES OF THE FORMULA TO FOLLOW (BUT MAKE YOURS MORE CREATIVE):\n"
212
- for i, example in enumerate(random_examples, 1):
213
- webinar_names_instruction += f"{i}. {example}\n"
214
-
215
- # Instrucciones específicas (translated to English)
216
- webinar_names_instruction += "\nSPECIFIC INSTRUCTIONS:\n"
217
- webinar_names_instruction += "1. Use the same basic structure as the examples but add creative twists\n"
218
- webinar_names_instruction += "2. Create curiosity gaps that make people want to learn more\n"
219
- webinar_names_instruction += "3. Use unexpected word combinations that surprise the reader\n"
220
- webinar_names_instruction += "4. Incorporate pattern interrupts that make people stop and think\n"
221
- webinar_names_instruction += f"5. Adapt the content for {audience} while making titles more memorable and disruptive\n\n"
222
- webinar_names_instruction += f"FORMULA TO FOLLOW (AS A BASE):\n{selected_formula['description']}\n\n"
223
- webinar_names_instruction += f"""
224
- CREATIVE TECHNIQUES TO APPLY:
225
- 1. Use unexpected metaphors or analogies
226
- 2. Create intriguing contrasts or paradoxes
227
- 3. Challenge conventional wisdom with provocative statements
228
- 4. Use power words that evoke emotion
229
- 5. Create curiosity with incomplete loops or questions
230
- 6. Use specific numbers or data points that seem unusual
231
-
232
- GENERATE NOW:
233
- Create {number_of_names} creative, disruptive webinar names that use the formula structure as a base but add unexpected creative elements to make them stand out.
234
- """
235
-
236
- # Enviar el mensaje al modelo
237
- # Use the common generate_content function
238
- return generate_content(webinar_names_instruction, temperature)
239
-
240
- # Update the create_input_section function to include the product/offer field
241
- def create_input_section(col, audience_key, product_key, formulas, formula_key, offer_key=None):
242
- audience = col.text_input("¿Quién es tu público objetivo?", placeholder="Ejemplo: Emprendedores digitales", key=audience_key)
243
- product = col.text_input("¿Sobre qué tema es tu webinar?", placeholder="Ejemplo: Marketing de afiliados", key=product_key)
244
-
245
- # Add the new product/offer field if a key is provided
246
- offer = None
247
- if offer_key:
248
- offer = col.text_input("¿Cuál es tu producto u oferta?", placeholder="Ejemplo: Curso de marketing de afiliados", key=offer_key)
249
-
250
- # Formula selection
251
- formula_keys = list(formulas.keys())
252
- selected_formula_key = col.selectbox(
253
- "Selecciona un framework de webinar",
254
- options=formula_keys,
255
- key=formula_key
256
- )
257
-
258
- if offer_key:
259
- return audience, product, selected_formula_key, offer
260
- else:
261
- return audience, product, selected_formula_key
262
-
263
- # Update the generate_webinar_script function to include the offer parameter
264
- def generate_webinar_script(audience, topic, temperature, selected_formula, offer=None, creative_idea=None):
265
- model = initialize_model(temperature)
266
-
267
- # Include offer in the system prompt if provided
268
- offer_text = f" and selling {offer}" if offer else ""
269
-
270
- # Incluir las instrucciones del sistema en el prompt principal
271
- system_prompt = f"""You are a collaborative team of world-class experts working together to create an exceptional webinar script that converts audience into customers.
272
-
273
- THE EXPERT TEAM:
274
-
275
- 1. MASTER WEBINAR STRATEGIST:
276
- - Expert in webinar frameworks and conversion strategies
277
- - Trained in the Perfect Webinar methodology by Russell Brunson
278
- - Ensures the script follows the selected framework structure precisely
279
- - Focuses on strategic placement of key conversion elements
280
-
281
- 2. ELITE DIRECT RESPONSE COPYWRITER:
282
- - Trained by Gary Halbert, Gary Bencivenga, and David Ogilvy
283
- - Creates compelling hooks, stories, and persuasive elements
284
- - Crafts irresistible calls to action that drives conversions
285
- - Ensures the language resonates with the target audience
286
-
287
- 3. AUDIENCE PSYCHOLOGY SPECIALIST:
288
- - Expert in understanding audience motivations and objections
289
- - Creates content that builds genuine connection and trust
290
- - Identifies and addresses hidden fears and desires
291
- - Ensures the content feels personal and relevant
292
-
293
- 4. STORYTELLING MASTER:
294
- - Creates compelling narratives that illustrate key points
295
- - Develops relatable examples and case studies
296
- - Ensures stories support the transformation being offered
297
- - Makes complex concepts accessible through narrative
298
-
299
- 5. WEBINAR ENGAGEMENT EXPERT:
300
- - Specializes in maintaining audience attention throughout
301
- - Creates interactive elements and engagement hooks
302
- - Develops compelling transitions between sections
303
- - Ensures the webinar flows naturally and keeps interest high
304
-
305
- FORMAT REQUIREMENTS:
306
- - Create a complete webinar script with clear sections and subsections
307
- - Include specific talking points for each section
308
- - Write in a conversational, engaging tone
309
- - Include persuasive elements and calls to action
310
- - Follow the selected webinar framework structure exactly
311
- - WRITE THE ENTIRE SCRIPT IN SPANISH
312
- - Start directly with the webinar content without introductory text
313
- - DO NOT include any explanatory text at the beginning like "Here's the webinar script..." or "I've created a webinar script..."
314
-
315
- COLLABORATIVE PROCESS:
316
- As a team of experts, you will:
317
- 1. Analyze the framework '{selected_formula['description']}' to understand its core principles
318
- 2. Identify how to best adapt this framework for {audience} learning about {topic}{offer_text}
319
- 3. Create persuasive language that resonates with {audience}
320
- 4. Ensure the script maintains engagement throughout
321
- 5. Follow the exact structure provided in the framework"""
322
-
323
- # Añadir instrucciones para la idea creativa si existe
324
- if creative_idea:
325
- system_prompt += f"""
326
- CREATIVE CONCEPT:
327
- Use the following creative concept as the central theme for the webinar:
328
- "{creative_idea}"
329
-
330
- CREATIVE CONCEPT INSTRUCTIONS:
331
- 1. This concept should be the unifying theme across the entire webinar
332
- 2. Use it as a metaphor or analogy throughout the presentation
333
- 3. Develop different aspects of this concept in each section
334
- 4. Make sure the concept naturally connects to the product benefits
335
- 5. The concept should make the webinar more memorable and engaging
336
- """
337
-
338
- # Update the task instructions to include the offer
339
- offer_instruction = f" and selling {offer}" if offer else ""
340
-
341
- # Instrucciones específicas para la tarea
342
- webinar_script_instruction = (
343
- f"{system_prompt}\n\n"
344
- f"\nYour task is to create a complete webinar script IN SPANISH for {audience} "
345
- f"about {topic}{offer_instruction} that is persuasive and converts the audience into customers. "
346
- f"The script must follow exactly the structure of the framework '{selected_formula['description']}' "
347
- f"and must include all the necessary elements for a successful webinar."
348
- f"\n\n"
349
- )
350
-
351
- # Estructura del webinar
352
- webinar_script_instruction += "WEBINAR STRUCTURE TO FOLLOW:\n"
353
- for i, step in enumerate(selected_formula['structure'], 1):
354
- webinar_script_instruction += f"{i}. {step}\n"
355
-
356
- # Ejemplos de webinars exitosos
357
- webinar_script_instruction += "\n\nEXAMPLES OF SUCCESSFUL WEBINARS WITH THIS STRUCTURE:\n"
358
- for i, example in enumerate(selected_formula['examples'], 1):
359
- webinar_script_instruction += f"{i}. {example}\n"
360
-
361
- # Instrucciones específicas - Reforzar el español
362
- webinar_script_instruction += f"""
363
- SPECIFIC INSTRUCTIONS:
364
- 1. Create a complete script that follows exactly the provided structure
365
- 2. Include persuasive elements and clear calls to action
366
- 3. Adapt the language and examples specifically for {audience}
367
- 4. Focus on the transformative benefits of {topic}
368
- 5. Include relevant stories and examples that reinforce your points
369
- 6. Use a conversational but professional tone
370
- 7. Make sure each section fulfills its specific purpose in the framework
371
- 8. IMPORTANT: Write the ENTIRE script in Spanish (neutral Latin American Spanish)
372
- 9. DO NOT include any introductory text like "Here's the webinar script..." or "I've created a webinar script..."
373
- 10. Start directly with the webinar title and content
374
- 11. ALL section titles, headers, and content MUST be in Spanish
375
- 12. Ensure ALL examples, stories, and calls to action are in Spanish
376
-
377
- GENERATE NOW:
378
- Create a complete webinar script following faithfully the structure of the selected framework, entirely in Spanish.
379
- """
380
-
381
- # Enviar el mensaje al modelo
382
- chat_session = model.start_chat(
383
- history=[
384
- {
385
- "role": "user",
386
- "parts": [webinar_script_instruction],
387
- },
388
- ]
389
- )
390
- response = chat_session.send_message("Generate the webinar script IN NEUTRAL SPANISH following exactly the provided structure. All content must be in neutral Spanish (not Spain Spanish). Start directly with the webinar content without any introductory text.")
391
-
392
- return response.text
393
-
394
- # Función para validar entradas (evita duplicación)
395
- def validate_inputs(audience, product):
396
- has_audience = audience.strip() != ""
397
- has_product = product.strip() != ""
398
- return has_audience and has_product
399
-
400
- # Update the load_css function comment to be more descriptive
401
- def load_css():
402
- css_path = "styles/styles.css"
403
- if os.path.exists(css_path):
404
- try:
405
- with open(css_path, "r") as f:
406
- st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
407
- except Exception as e:
408
- st.warning(f"Error al cargar el archivo CSS: {str(e)}")
409
- else:
410
- st.warning(f"No se encontró el archivo CSS en {css_path}")
411
-
412
- # Modify the page config section to include the CSS loading and remove menu
413
- st.set_page_config(
414
- page_title="Perfect Webinar Framework",
415
- layout="wide",
416
- initial_sidebar_state="expanded",
417
- menu_items=None # This removes the three dots menu
418
- )
419
- load_css() # This will load the styles from styles.css
420
-
421
- # Leer el contenido del archivo manual.md
422
- with open("manual.md", "r", encoding="utf-8") as file:
423
- manual_content = file.read()
424
-
425
- # Mostrar el contenido del manual en el sidebar
426
- st.sidebar.markdown(manual_content)
427
-
428
- # Agregar título y subtítulo usando HTML
429
- st.markdown("<h1 style='text-align: center;'>Perfect Webinar Framework</h1>", unsafe_allow_html=True)
430
- st.markdown("<h3 style='text-align: center;'>Crea guiones y títulos de webinars persuasivos que convierten</h3>", unsafe_allow_html=True)
431
-
432
- # Crear pestañas para la interfaz
433
- tab1, tab2 = st.tabs(["Guiones de Webinar", "Nombres de Webinar"])
434
-
435
- # Primera pestaña - Generador de Guiones de Webinar
436
- with tab1:
437
- tab1.subheader("Script Webinar")
438
-
439
- # Crear columnas para la interfaz
440
- col1, col2 = tab1.columns([1, 2])
441
-
442
- # Columna de entrada usando la función reutilizable
443
- with col1:
444
- # Inputs básicos (fuera del acordeón)
445
- webinar_script_audience = st.text_input("¿Quién es tu público objetivo?", placeholder="Ejemplo: Emprendedores digitales", key="webinar_script_audience")
446
- webinar_script_product = st.text_input("¿Sobre qué tema es tu webinar?", placeholder="Ejemplo: Marketing de afiliados", key="webinar_script_product")
447
- webinar_script_offer = st.text_input("¿Cuál es tu producto u oferta?", placeholder="Ejemplo: Curso de marketing de afiliados", key="webinar_script_offer")
448
-
449
- # Botón de generación (movido aquí, justo después de los campos principales)
450
- submit_webinar_script = st.button("GENERAR GUIÓN DE WEBINAR ▶▶", key="generate_webinar_script")
451
-
452
- # Opciones avanzadas en el acordeón
453
- with st.expander("Personaliza tu guión de webinar"):
454
- # Selector de fórmula (ahora dentro del acordeón)
455
- selected_webinar_formula_key = st.selectbox(
456
- "Selecciona un framework de webinar",
457
- options=list(webinar_formulas.keys()),
458
- key="webinar_formula"
459
- )
460
-
461
- # Nuevo campo para la idea creativa
462
- creative_idea = st.text_area(
463
- "Idea creativa (opcional)",
464
- placeholder="Introduce una idea o concepto creativo que quieras usar como tema central en tu webinar",
465
- help="Este concepto será el tema unificador a lo largo de tu webinar, haciéndolo más memorable y atractivo",
466
- key="webinar_creative_idea"
467
- )
468
-
469
- # Slider de creatividad (ya existente)
470
- webinar_script_temperature = st.slider("Creatividad", min_value=0.0, max_value=2.0, value=1.0, step=0.1, key="webinar_script_temp")
471
-
472
- selected_webinar_formula = webinar_formulas[selected_webinar_formula_key]
473
-
474
- # Usar la función generate_and_display para generar y mostrar el guión
475
- if submit_webinar_script:
476
- generate_and_display(
477
- col=col2,
478
- generator_func=generate_webinar_script,
479
- audience=webinar_script_audience,
480
- product=webinar_script_product,
481
- temperature=webinar_script_temperature,
482
- selected_formula=selected_webinar_formula,
483
- content_type="script",
484
- offer=webinar_script_offer if webinar_script_offer.strip() else None,
485
- creative_idea=creative_idea if creative_idea.strip() else None
486
- )
487
-
488
- # Segunda pestaña - Generador de Nombres de Webinar
489
- with tab2:
490
- tab2.subheader("Nombres de Webinar")
491
-
492
- # Crear columnas para la interfaz
493
- col1, col2 = tab2.columns([1, 2])
494
-
495
- # Columna de entrada
496
- with col1:
497
- # Inputs básicos
498
- webinar_names_audience = st.text_input("¿Quién es tu público objetivo?", placeholder="Ejemplo: Emprendedores digitales", key="webinar_names_audience")
499
- webinar_names_product = st.text_input("¿Sobre qué tema es tu webinar?", placeholder="Ejemplo: Marketing de afiliados", key="webinar_names_product")
500
-
501
- # Botón de generación (movido aquí, justo después de los campos principales)
502
- submit_webinar_names = st.button("GENERAR NOMBRES DE WEBINAR ▶▶", key="generate_webinar_names")
503
-
504
- # Opciones avanzadas en el acordeón
505
- with st.expander("Personaliza tus nombres de webinar"):
506
- # Selector de fórmula
507
- selected_name_formula_key = st.selectbox(
508
- "Selecciona una fórmula para tus nombres",
509
- options=list(webinar_name_formulas.keys()),
510
- key="webinar_name_formula"
511
- )
512
-
513
- # Selector de ángulo
514
- selected_angle = st.selectbox(
515
- "Selecciona un ángulo (opcional)",
516
- options=["NINGUNO"] + list(angles_webinar_names.keys()),
517
- key="webinar_name_angle"
518
- )
519
-
520
- # Número de nombres a generar
521
- number_of_names = st.slider("Número de nombres a generar", min_value=3, max_value=15, value=5, step=1, key="number_of_names")
522
-
523
- # Slider de creatividad
524
- webinar_names_temperature = st.slider("Creatividad", min_value=0.0, max_value=2.0, value=1.0, step=0.1, key="webinar_names_temp")
525
-
526
- selected_name_formula = webinar_name_formulas[selected_name_formula_key]
527
-
528
- # Usar la función generate_and_display para generar y mostrar los nombres
529
- if submit_webinar_names:
530
- generate_and_display(
531
- col=col2,
532
- generator_func=generate_webinar_names,
533
- audience=webinar_names_audience,
534
- product=webinar_names_product,
535
- temperature=webinar_names_temperature,
536
- selected_formula=selected_name_formula,
537
- content_type="names",
538
- number_of_names=number_of_names,
539
- selected_angle=selected_angle if selected_angle != "NINGUNO" else None
 
 
540
  )
 
1
+ from dotenv import load_dotenv
2
+ import streamlit as st
3
+ import os
4
+ import google.generativeai as genai
5
+ import random
6
+ import datetime
7
+ from streamlit import session_state as state
8
+ from formulas.webinar_formulas import webinar_formulas
9
+ from formulas.webinar_name_formulas import webinar_name_formulas
10
+ from formulas.angles_webinar_names import angles_webinar_names
11
+
12
+ # Cargar las variables de entorno
13
+ load_dotenv()
14
+
15
+ # Configurar la API de Google
16
+ genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
17
+
18
+ # Función auxiliar para mostrar el contenido generado y los botones de descarga
19
+ def display_generated_content(col, generated_content, content_type):
20
+ timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
21
+
22
+ # Determinar el tipo de contenido para personalizar los botones y títulos
23
+ if content_type == "script":
24
+ download_label = "DESCARGAR GUIÓN DE WEBINAR ▶▶"
25
+ file_name = f"guion_webinar_{timestamp}.txt"
26
+ subheader_text = "Tu guión de webinar:"
27
+
28
+ # Mostrar botón de descarga superior para guiones
29
+ col.download_button(
30
+ label=download_label,
31
+ data=generated_content,
32
+ file_name=file_name,
33
+ mime="text/plain",
34
+ key=f"download_top_{content_type}"
35
+ )
36
+
37
+ # Mostrar el contenido generado
38
+ col.subheader(subheader_text)
39
+ col.markdown(generated_content)
40
+
41
+ # Mostrar botón de descarga inferior
42
+ col.download_button(
43
+ label=download_label,
44
+ data=generated_content,
45
+ file_name=file_name,
46
+ mime="text/plain",
47
+ key=f"download_bottom_{content_type}"
48
+ )
49
+ else: # nombres
50
+ subheader_text = "Tus nombres de webinar:"
51
+ file_name = f"nombres_webinar_{timestamp}.txt"
52
+ download_label = "DESCARGAR NOMBRES DE WEBINAR ▶▶"
53
+
54
+ # Contar el número de nombres generados (aproximadamente por el número de líneas)
55
+ num_names = len([line for line in generated_content.split('\n') if line.strip().startswith(('1.', '2.', '3.', '4.', '5.', '6.', '7.', '8.', '9.', '10.', '11.', '12.', '13.', '14.', '15.'))])
56
+
57
+ # Determinar si hay más de 5 nombres para mostrar los botones de descarga
58
+ has_many_items = num_names > 5
59
+
60
+ # Usar el mismo formato que para los scripts, pero con clases específicas para nombres
61
+ # Mostrar botón de descarga superior si hay muchos nombres
62
+ if has_many_items:
63
+ # Usar el mismo formato de key que para scripts, pero con content_type="names"
64
+ col.download_button(
65
+ label=download_label,
66
+ data=generated_content,
67
+ file_name=file_name,
68
+ mime="text/plain",
69
+ key=f"download_top_{content_type}",
70
+ help="Descargar todos los nombres generados"
71
+ )
72
+
73
+ # Mostrar el contenido generado
74
+ col.subheader(subheader_text)
75
+ col.markdown(generated_content)
76
+
77
+ # Mostrar botón de descarga inferior solo si hay más de 5 nombres
78
+ if has_many_items:
79
+ # Usar el mismo formato de key que para scripts, pero con content_type="names"
80
+ col.download_button(
81
+ label=download_label,
82
+ data=generated_content,
83
+ file_name=file_name,
84
+ mime="text/plain",
85
+ key=f"download_bottom_{content_type}",
86
+ help="Descargar todos los nombres generados"
87
+ )
88
+
89
+ # Implementar la función generate_and_display para reemplazar código duplicado
90
+ def generate_and_display(col, generator_func, audience, product, temperature, selected_formula, content_type, **kwargs):
91
+ if validate_inputs(audience, product):
92
+ try:
93
+ with col:
94
+ with st.spinner(f"Generando {'guión' if content_type == 'script' else 'nombres'} de webinar...", show_time=True):
95
+ # Llamar a la función generadora con los parámetros adecuados
96
+ generated_content = generator_func(
97
+ audience=audience,
98
+ topic=product,
99
+ temperature=temperature,
100
+ selected_formula=selected_formula,
101
+ **kwargs
102
+ )
103
+
104
+ # Mostrar el contenido generado usando la función auxiliar
105
+ display_generated_content(col, generated_content, content_type)
106
+
107
+ except ValueError as e:
108
+ col.error(f"Error: {str(e)}")
109
+ else:
110
+ col.error("Por favor, proporciona el público objetivo y el tema del webinar.")
111
+
112
+ # Función para crear la configuración del modelo (evita duplicación)
113
+ def create_model_config(temperature):
114
+ return {
115
+ "temperature": temperature,
116
+ "top_p": 0.65,
117
+ "top_k": 360,
118
+ "max_output_tokens": 8196,
119
+ }
120
+
121
+ # Función para inicializar el modelo
122
+ def initialize_model(temperature):
123
+ config = create_model_config(temperature)
124
+ return genai.GenerativeModel(
125
+ model_name="gemini-2.0-flash",
126
+ generation_config=config,
127
+ )
128
+
129
+ # Refactored model interaction function to reduce duplication
130
+ def generate_content(prompt_instructions, temperature):
131
+ model = initialize_model(temperature)
132
+ chat_session = model.start_chat(
133
+ history=[
134
+ {
135
+ "role": "user",
136
+ "parts": [prompt_instructions],
137
+ },
138
+ ]
139
+ )
140
+ response = chat_session.send_message("Generate the content following exactly the provided instructions. All content must be in Spanish.")
141
+ return response.text
142
+
143
+ # Función para generar nombres de webinars
144
+ # Refactorizar la función generate_webinar_names para que acepte los mismos parámetros que generate_webinar_script
145
+ def generate_webinar_names(audience, topic, temperature, selected_formula, number_of_names=5, selected_angle=None, **kwargs):
146
+ # Incluir las instrucciones del sistema en el prompt principal
147
+ system_prompt = """You are a world-class copywriter, with expertise in crafting compelling and disruptive webinar titles that immediately capture the audience's attention and drive registrations.
148
+
149
+ FORMAT RULES:
150
+ - Each webinar name must start with number and period
151
+ - One webinar name per line
152
+ - No explanations or categories
153
+ - Add a line break between each name
154
+ - Avoid unnecessary : symbols
155
+ - Each webinar name must be a complete, intriguing and creative title
156
+ - WRITE ALL WEBINAR NAMES IN SPANISH
157
+
158
+ FORMAT EXAMPLE:
159
+ 1. Nombre del Webinar 1.
160
+
161
+ 2. Nombre del Webinar 2.
162
+
163
+ 3. Nombre del Webinar 3.
164
+
165
+ 4. Nombre del Webinar 4.
166
+
167
+ 5. Nombre del Webinar 5.
168
+
169
+ IMPORTANT:
170
+ - Each webinar name must be unique, memorable and disruptive
171
+ - Create curiosity and intrigue with unexpected combinations
172
+ - Use creative language that stands out from typical webinar titles
173
+ - Incorporate pattern interrupts that make people stop scrolling
174
+ - Adapt speaking language from the audience
175
+ - Focus on transformative benefits with creative angles
176
+ - Follow the selected formula structure but add creative twists
177
+ - WRITE ALL WEBINAR NAMES IN SPANISH"""
178
+
179
+ # Iniciar el prompt con las instrucciones del sistema
180
+ webinar_names_instruction = f"{system_prompt}\n\n"
181
+
182
+ # Añadir instrucciones de ángulo solo si no es "NINGUNO" y se proporcionó un ángulo
183
+ if selected_angle and selected_angle != "NINGUNO":
184
+ webinar_names_instruction += f"""
185
+ MAIN ANGLE: {selected_angle}
186
+ SPECIFIC ANGLE INSTRUCTIONS:
187
+ {angles_webinar_names[selected_angle]["instruction"]}
188
+
189
+ IMPORTANT: The {selected_angle} angle should be applied as a "style layer" over the formula structure:
190
+ 1. Keep the base structure of the formula intact
191
+ 2. Apply the tone and style of the {selected_angle} angle
192
+ 3. Ensure that each element of the formula reflects the angle
193
+ 4. The angle affects "how" it is said, not "what" is said
194
+
195
+ SUCCESSFUL EXAMPLES OF THE {selected_angle} ANGLE:
196
+ """
197
+ for example in angles_webinar_names[selected_angle]["examples"]:
198
+ webinar_names_instruction += f"- {example}\n"
199
+
200
+ # Instrucciones específicas para la tarea
201
+ webinar_names_instruction += (
202
+ f"\nYour task is to create {number_of_names} irresistible, creative and disruptive webinar names for {audience} "
203
+ f"that instantly capture attention and generate registrations for a webinar about {topic}. "
204
+ f"Focus on awakening genuine curiosity, creating intrigue, and communicating the value they will get by registering."
205
+ f"\n\n"
206
+ f"IMPORTANT: Use these examples of the selected formula as inspiration, but make your titles more creative and disruptive. "
207
+ f"Each example represents a base structure to follow, but add unexpected elements and creative twists"
208
+ f":\n\n"
209
+ )
210
+
211
+ # Agregar ejemplos aleatorios de la fórmula (keeping examples in Spanish)
212
+ random_examples = random.sample(selected_formula['examples'], min(5, len(selected_formula['examples'])))
213
+ webinar_names_instruction += "EXAMPLES OF THE FORMULA TO FOLLOW (BUT MAKE YOURS MORE CREATIVE):\n"
214
+ for i, example in enumerate(random_examples, 1):
215
+ webinar_names_instruction += f"{i}. {example}\n"
216
+
217
+ # Instrucciones específicas (translated to English)
218
+ webinar_names_instruction += "\nSPECIFIC INSTRUCTIONS:\n"
219
+ webinar_names_instruction += "1. Use the same basic structure as the examples but add creative twists\n"
220
+ webinar_names_instruction += "2. Create curiosity gaps that make people want to learn more\n"
221
+ webinar_names_instruction += "3. Use unexpected word combinations that surprise the reader\n"
222
+ webinar_names_instruction += "4. Incorporate pattern interrupts that make people stop and think\n"
223
+ webinar_names_instruction += f"5. Adapt the content for {audience} while making titles more memorable and disruptive\n\n"
224
+ webinar_names_instruction += f"FORMULA TO FOLLOW (AS A BASE):\n{selected_formula['description']}\n\n"
225
+ webinar_names_instruction += f"""
226
+ CREATIVE TECHNIQUES TO APPLY:
227
+ 1. Use unexpected metaphors or analogies
228
+ 2. Create intriguing contrasts or paradoxes
229
+ 3. Challenge conventional wisdom with provocative statements
230
+ 4. Use power words that evoke emotion
231
+ 5. Create curiosity with incomplete loops or questions
232
+ 6. Use specific numbers or data points that seem unusual
233
+
234
+ GENERATE NOW:
235
+ Create {number_of_names} creative, disruptive webinar names that use the formula structure as a base but add unexpected creative elements to make them stand out.
236
+ """
237
+
238
+ # Enviar el mensaje al modelo
239
+ # Use the common generate_content function
240
+ return generate_content(webinar_names_instruction, temperature)
241
+
242
+ # Update the create_input_section function to include the product/offer field
243
+ def create_input_section(col, audience_key, product_key, formulas, formula_key, offer_key=None):
244
+ audience = col.text_input("¿Quién es tu público objetivo?", placeholder="Ejemplo: Emprendedores digitales", key=audience_key)
245
+ product = col.text_input("¿Sobre qué tema es tu webinar?", placeholder="Ejemplo: Marketing de afiliados", key=product_key)
246
+
247
+ # Add the new product/offer field if a key is provided
248
+ offer = None
249
+ if offer_key:
250
+ offer = col.text_input("¿Cuál es tu producto u oferta?", placeholder="Ejemplo: Curso de marketing de afiliados", key=offer_key)
251
+
252
+ # Formula selection
253
+ formula_keys = list(formulas.keys())
254
+ selected_formula_key = col.selectbox(
255
+ "Selecciona un framework de webinar",
256
+ options=formula_keys,
257
+ key=formula_key
258
+ )
259
+
260
+ if offer_key:
261
+ return audience, product, selected_formula_key, offer
262
+ else:
263
+ return audience, product, selected_formula_key
264
+
265
+ # Update the generate_webinar_script function to include the offer parameter
266
+ def generate_webinar_script(audience, topic, temperature, selected_formula, offer=None, creative_idea=None):
267
+ model = initialize_model(temperature)
268
+
269
+ # Include offer in the system prompt if provided
270
+ offer_text = f" and selling {offer}" if offer else ""
271
+
272
+ # Incluir las instrucciones del sistema en el prompt principal
273
+ system_prompt = f"""You are a collaborative team of world-class experts working together to create an exceptional webinar script that converts audience into customers.
274
+
275
+ THE EXPERT TEAM:
276
+
277
+ 1. MASTER WEBINAR STRATEGIST:
278
+ - Expert in webinar frameworks and conversion strategies
279
+ - Trained in the Perfect Webinar methodology by Russell Brunson
280
+ - Ensures the script follows the selected framework structure precisely
281
+ - Focuses on strategic placement of key conversion elements
282
+
283
+ 2. ELITE DIRECT RESPONSE COPYWRITER:
284
+ - Trained by Gary Halbert, Gary Bencivenga, and David Ogilvy
285
+ - Creates compelling hooks, stories, and persuasive elements
286
+ - Crafts irresistible calls to action that drives conversions
287
+ - Ensures the language resonates with the target audience
288
+
289
+ 3. AUDIENCE PSYCHOLOGY SPECIALIST:
290
+ - Expert in understanding audience motivations and objections
291
+ - Creates content that builds genuine connection and trust
292
+ - Identifies and addresses hidden fears and desires
293
+ - Ensures the content feels personal and relevant
294
+
295
+ 4. STORYTELLING MASTER:
296
+ - Creates compelling narratives that illustrate key points
297
+ - Develops relatable examples and case studies
298
+ - Ensures stories support the transformation being offered
299
+ - Makes complex concepts accessible through narrative
300
+
301
+ 5. WEBINAR ENGAGEMENT EXPERT:
302
+ - Specializes in maintaining audience attention throughout
303
+ - Creates interactive elements and engagement hooks
304
+ - Develops compelling transitions between sections
305
+ - Ensures the webinar flows naturally and keeps interest high
306
+
307
+ FORMAT REQUIREMENTS:
308
+ - Create a complete webinar script with clear sections and subsections
309
+ - Include specific talking points for each section
310
+ - Write in a conversational, engaging tone
311
+ - Include persuasive elements and calls to action
312
+ - Follow the selected webinar framework structure exactly
313
+ - WRITE THE ENTIRE SCRIPT IN SPANISH
314
+ - Start directly with the webinar content without introductory text
315
+ - DO NOT include any explanatory text at the beginning like "Here's the webinar script..." or "I've created a webinar script..."
316
+
317
+ COLLABORATIVE PROCESS:
318
+ As a team of experts, you will:
319
+ 1. Analyze the framework '{selected_formula['description']}' to understand its core principles
320
+ 2. Identify how to best adapt this framework for {audience} learning about {topic}{offer_text}
321
+ 3. Create persuasive language that resonates with {audience}
322
+ 4. Ensure the script maintains engagement throughout
323
+ 5. Follow the exact structure provided in the framework"""
324
+
325
+ # Añadir instrucciones para la idea creativa si existe
326
+ if creative_idea:
327
+ system_prompt += f"""
328
+ CREATIVE CONCEPT:
329
+ Use the following creative concept as the central theme for the webinar:
330
+ "{creative_idea}"
331
+
332
+ CREATIVE CONCEPT INSTRUCTIONS:
333
+ 1. This concept should be the unifying theme across the entire webinar
334
+ 2. Use it as a metaphor or analogy throughout the presentation
335
+ 3. Develop different aspects of this concept in each section
336
+ 4. Make sure the concept naturally connects to the product benefits
337
+ 5. The concept should make the webinar more memorable and engaging
338
+ """
339
+
340
+ # Update the task instructions to include the offer
341
+ offer_instruction = f" and selling {offer}" if offer else ""
342
+
343
+ # Instrucciones específicas para la tarea
344
+ webinar_script_instruction = (
345
+ f"{system_prompt}\n\n"
346
+ f"\nYour task is to create a complete webinar script IN SPANISH for {audience} "
347
+ f"about {topic}{offer_instruction} that is persuasive and converts the audience into customers. "
348
+ f"The script must follow exactly the structure of the framework '{selected_formula['description']}' "
349
+ f"and must include all the necessary elements for a successful webinar."
350
+ f"\n\n"
351
+ )
352
+
353
+ # Estructura del webinar
354
+ webinar_script_instruction += "WEBINAR STRUCTURE TO FOLLOW:\n"
355
+ for i, step in enumerate(selected_formula['structure'], 1):
356
+ webinar_script_instruction += f"{i}. {step}\n"
357
+
358
+ # Ejemplos de webinars exitosos
359
+ webinar_script_instruction += "\n\nEXAMPLES OF SUCCESSFUL WEBINARS WITH THIS STRUCTURE:\n"
360
+ for i, example in enumerate(selected_formula['examples'], 1):
361
+ webinar_script_instruction += f"{i}. {example}\n"
362
+
363
+ # Instrucciones específicas - Reforzar el español
364
+ webinar_script_instruction += f"""
365
+ SPECIFIC INSTRUCTIONS:
366
+ 1. Create a complete script that follows exactly the provided structure
367
+ 2. Include persuasive elements and clear calls to action
368
+ 3. Adapt the language and examples specifically for {audience}
369
+ 4. Focus on the transformative benefits of {topic}
370
+ 5. Include relevant stories and examples that reinforce your points
371
+ 6. Use a conversational but professional tone
372
+ 7. Make sure each section fulfills its specific purpose in the framework
373
+ 8. IMPORTANT: Write the ENTIRE script in Spanish (neutral Latin American Spanish)
374
+ 9. DO NOT include any introductory text like "Here's the webinar script..." or "I've created a webinar script..."
375
+ 10. Start directly with the webinar title and content
376
+ 11. ALL section titles, headers, and content MUST be in Spanish
377
+ 12. Ensure ALL examples, stories, and calls to action are in Spanish
378
+
379
+ GENERATE NOW:
380
+ Create a complete webinar script following faithfully the structure of the selected framework, entirely in Spanish.
381
+ """
382
+
383
+ # Enviar el mensaje al modelo
384
+ chat_session = model.start_chat(
385
+ history=[
386
+ {
387
+ "role": "user",
388
+ "parts": [webinar_script_instruction],
389
+ },
390
+ ]
391
+ )
392
+ response = chat_session.send_message("Generate the webinar script IN NEUTRAL SPANISH following exactly the provided structure. All content must be in neutral Spanish (not Spain Spanish). Start directly with the webinar content without any introductory text.")
393
+
394
+ return response.text
395
+
396
+ # Función para validar entradas (evita duplicación)
397
+ def validate_inputs(audience, product):
398
+ has_audience = audience.strip() != ""
399
+ has_product = product.strip() != ""
400
+ return has_audience and has_product
401
+
402
+ # Update the load_css function comment to be more descriptive
403
+ def load_css():
404
+ css_path = "styles/styles.css"
405
+ if os.path.exists(css_path):
406
+ try:
407
+ with open(css_path, "r") as f:
408
+ st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
409
+ except Exception as e:
410
+ st.warning(f"Error al cargar el archivo CSS: {str(e)}")
411
+ else:
412
+ st.warning(f"No se encontró el archivo CSS en {css_path}")
413
+
414
+ # Modify the page config section to include the CSS loading and remove menu
415
+ st.set_page_config(
416
+ page_title="Perfect Webinar Framework",
417
+ layout="wide",
418
+ initial_sidebar_state="expanded",
419
+ menu_items=None # This removes the three dots menu
420
+ )
421
+ load_css() # This will load the styles from styles.css
422
+
423
+ # Leer el contenido del archivo manual.md
424
+ with open("manual.md", "r", encoding="utf-8") as file:
425
+ manual_content = file.read()
426
+
427
+ # Mostrar el contenido del manual en el sidebar
428
+ st.sidebar.markdown(manual_content)
429
+
430
+ # Agregar título y subtítulo usando HTML
431
+ st.markdown("<h1 style='text-align: center;'>Perfect Webinar Framework</h1>", unsafe_allow_html=True)
432
+ st.markdown("<h3 style='text-align: center;'>Crea guiones y títulos de webinars persuasivos que convierten</h3>", unsafe_allow_html=True)
433
+
434
+ # Crear pestañas para la interfaz
435
+ tab1, tab2 = st.tabs(["Guiones de Webinar", "Nombres de Webinar"])
436
+
437
+ # Primera pestaña - Generador de Guiones de Webinar
438
+ with tab1:
439
+ tab1.subheader("Script Webinar")
440
+
441
+ # Crear columnas para la interfaz
442
+ col1, col2 = tab1.columns([1, 2])
443
+
444
+ # Columna de entrada usando la función reutilizable
445
+ with col1:
446
+ # Inputs básicos (fuera del acordeón)
447
+ webinar_script_audience = st.text_input("¿Quién es tu público objetivo?", placeholder="Ejemplo: Emprendedores digitales", key="webinar_script_audience")
448
+ webinar_script_product = st.text_input("¿Sobre qué tema es tu webinar?", placeholder="Ejemplo: Marketing de afiliados", key="webinar_script_product")
449
+ webinar_script_offer = st.text_input("¿Cuál es tu producto u oferta?", placeholder="Ejemplo: Curso de marketing de afiliados", key="webinar_script_offer")
450
+
451
+ # Botón de generación (movido aquí, justo después de los campos principales)
452
+ submit_webinar_script = st.button("GENERAR GUIÓN DE WEBINAR ▶▶", key="generate_webinar_script")
453
+
454
+ # Opciones avanzadas en el acordeón
455
+ with st.expander("Personaliza tu guión de webinar"):
456
+ # Selector de fórmula (ahora dentro del acordeón)
457
+ selected_webinar_formula_key = st.selectbox(
458
+ "Selecciona un framework de webinar",
459
+ options=list(webinar_formulas.keys()),
460
+ key="webinar_formula"
461
+ )
462
+
463
+ # Nuevo campo para la idea creativa
464
+ creative_idea = st.text_area(
465
+ "Idea creativa (opcional)",
466
+ placeholder="Introduce una idea o concepto creativo que quieras usar como tema central en tu webinar",
467
+ help="Este concepto será el tema unificador a lo largo de tu webinar, haciéndolo más memorable y atractivo",
468
+ key="webinar_creative_idea"
469
+ )
470
+
471
+ # Slider de creatividad (ya existente)
472
+ webinar_script_temperature = st.slider("Creatividad", min_value=0.0, max_value=2.0, value=1.0, step=0.1, key="webinar_script_temp")
473
+
474
+ selected_webinar_formula = webinar_formulas[selected_webinar_formula_key]
475
+
476
+ # Usar la función generate_and_display para generar y mostrar el guión
477
+ if submit_webinar_script:
478
+ generate_and_display(
479
+ col=col2,
480
+ generator_func=generate_webinar_script,
481
+ audience=webinar_script_audience,
482
+ product=webinar_script_product,
483
+ temperature=webinar_script_temperature,
484
+ selected_formula=selected_webinar_formula,
485
+ content_type="script",
486
+ offer=webinar_script_offer if webinar_script_offer.strip() else None,
487
+ creative_idea=creative_idea if creative_idea.strip() else None
488
+ )
489
+
490
+ # Segunda pestaña - Generador de Nombres de Webinar
491
+ with tab2:
492
+ tab2.subheader("Nombres de Webinar")
493
+
494
+ # Crear columnas para la interfaz
495
+ col1, col2 = tab2.columns([1, 2])
496
+
497
+ # Columna de entrada
498
+ with col1:
499
+ # Inputs básicos
500
+ webinar_names_audience = st.text_input("¿Quién es tu público objetivo?", placeholder="Ejemplo: Emprendedores digitales", key="webinar_names_audience")
501
+ webinar_names_product = st.text_input("¿Sobre qué tema es tu webinar?", placeholder="Ejemplo: Marketing de afiliados", key="webinar_names_product")
502
+
503
+ # Botón de generación (movido aquí, justo después de los campos principales)
504
+ submit_webinar_names = st.button("GENERAR NOMBRES DE WEBINAR ▶▶", key="generate_webinar_names")
505
+
506
+ # Opciones avanzadas en el acordeón
507
+ with st.expander("Personaliza tus nombres de webinar"):
508
+ # Selector de fórmula
509
+ selected_name_formula_key = st.selectbox(
510
+ "Selecciona una fórmula para tus nombres",
511
+ options=list(webinar_name_formulas.keys()),
512
+ key="webinar_name_formula"
513
+ )
514
+
515
+ # Selector de ángulo
516
+ selected_angle = st.selectbox(
517
+ "Selecciona un ángulo (opcional)",
518
+ options=["NINGUNO"] + list(angles_webinar_names.keys()),
519
+ key="webinar_name_angle"
520
+ )
521
+
522
+ # Número de nombres a generar
523
+ number_of_names = st.slider("Número de nombres a generar", min_value=3, max_value=15, value=5, step=1, key="number_of_names")
524
+
525
+ # Slider de creatividad
526
+ webinar_names_temperature = st.slider("Creatividad", min_value=0.0, max_value=2.0, value=1.0, step=0.1, key="webinar_names_temp")
527
+
528
+ selected_name_formula = webinar_name_formulas[selected_name_formula_key]
529
+
530
+ # Usar la función generate_and_display para generar y mostrar los nombres
531
+ if submit_webinar_names:
532
+ generate_and_display(
533
+ col=col2,
534
+ generator_func=generate_webinar_names,
535
+ audience=webinar_names_audience,
536
+ product=webinar_names_product,
537
+ temperature=webinar_names_temperature,
538
+ selected_formula=selected_name_formula,
539
+ content_type="names",
540
+ number_of_names=number_of_names,
541
+ selected_angle=selected_angle if selected_angle != "NINGUNO" else None
542
  )
styles/styles.css CHANGED
@@ -1,99 +1,99 @@
1
- /* Custom button styles for Perfect Webinar Framework */
2
-
3
- /* Generate Webinar Script button - yellow with black border */
4
- div.stButton > button:first-child {
5
- width: 100%;
6
- margin-top: 0.5rem;
7
- border-radius: 5px;
8
- height: 3em;
9
- background: #FFD700; /* Solid yellow color like in the image */
10
- color: black;
11
- font-weight: bold;
12
- border: 1px solid black; /* Changed to 1px border */
13
- transition: all 0.3s ease;
14
- }
15
-
16
- div.stButton > button:first-child:hover {
17
- background: #FFDF33; /* Slightly brighter yellow on hover */
18
- transform: translateY(-2px);
19
- box-shadow: 0 4px 8px rgba(0,0,0,0.2);
20
- border: 1px solid black;
21
- }
22
-
23
- /* Download buttons - green/blue gradient */
24
- div.stDownloadButton > button:first-child {
25
- background: linear-gradient(90deg, #4CAF50, #2196F3); /* Green to blue gradient */
26
- color: white; /* White text for better visibility on gradient */
27
- font-weight: bold;
28
- padding: 0.5rem 1rem;
29
- border-radius: 5px;
30
- border: 1px solid black; /* 1px border as requested */
31
- transition: all 0.3s;
32
- width: 80%; /* Width 80% as requested */
33
- margin: 0 auto;
34
- display: block;
35
- }
36
-
37
- div.stDownloadButton > button:first-child:hover {
38
- background: linear-gradient(135deg, #3ED83E 0%, #4169E1 100%);
39
- transform: translateY(-2px) !important;
40
- box-shadow: 0 4px 8px rgba(0,0,0,0.3) !important;
41
- border: 2px solid black !important;
42
- }
43
-
44
- /* Special styling for download buttons in the webinar names container */
45
- .webinar-names-container div.stDownloadButton > button:first-child {
46
- background: linear-gradient(90deg, #FF5722, #FF9800); /* Orange gradient */
47
- color: white;
48
- font-weight: bold;
49
- border: 1px solid black;
50
- }
51
-
52
- .webinar-names-container div.stDownloadButton > button:first-child:hover {
53
- background: linear-gradient(135deg, #FF7043, #FFA726);
54
- transform: translateY(-2px) !important;
55
- box-shadow: 0 4px 8px rgba(0,0,0,0.3) !important;
56
- border: 2px solid black !important;
57
- }
58
-
59
-
60
- /* Reduce top spacing and hide unnecessary elements */
61
- .block-container {
62
- padding-top: 1rem;
63
- padding-bottom: 0rem;
64
- }
65
-
66
- header {
67
- visibility: hidden;
68
- }
69
-
70
- #MainMenu {
71
- visibility: hidden;
72
- }
73
-
74
- footer {
75
- visibility: hidden;
76
- }
77
-
78
- /* Add any other custom styles here */
79
-
80
-
81
- /* Styles for the webinar names container in the second tab */
82
- .webinar-names-container {
83
- padding: 15px;
84
- margin-top: 10px;
85
- margin-bottom: 10px;
86
- }
87
-
88
- /* Add border to all webinar name containers */
89
- .webinar-names-container.with-border {
90
- border: 1px solid #ddd;
91
- border-radius: 5px;
92
- padding: 20px;
93
- }
94
-
95
- /* Additional styling for containers with many items */
96
- .webinar-names-container.many-items .stDownloadButton {
97
- margin-top: 15px;
98
- margin-bottom: 15px;
99
  }
 
1
+ /* Custom button styles for Perfect Webinar Framework */
2
+
3
+ /* Generate Webinar Script button - yellow with black border */
4
+ div.stButton > button:first-child {
5
+ width: 100%;
6
+ margin-top: 0.5rem;
7
+ border-radius: 5px;
8
+ height: 3em;
9
+ background: #FFD700; /* Solid yellow color like in the image */
10
+ color: black;
11
+ font-weight: bold;
12
+ border: 1px solid black; /* Changed to 1px border */
13
+ transition: all 0.3s ease;
14
+ }
15
+
16
+ div.stButton > button:first-child:hover {
17
+ background: #FFDF33; /* Slightly brighter yellow on hover */
18
+ transform: translateY(-2px);
19
+ box-shadow: 0 4px 8px rgba(0,0,0,0.2);
20
+ border: 1px solid black;
21
+ }
22
+
23
+ /* Download buttons - green/blue gradient */
24
+ div.stDownloadButton > button:first-child {
25
+ background: linear-gradient(90deg, #4CAF50, #2196F3); /* Green to blue gradient */
26
+ color: white; /* White text for better visibility on gradient */
27
+ font-weight: bold;
28
+ padding: 0.5rem 1rem;
29
+ border-radius: 5px;
30
+ border: 1px solid black; /* 1px border as requested */
31
+ transition: all 0.3s;
32
+ width: 80%; /* Width 80% as requested */
33
+ margin: 0 auto;
34
+ display: block;
35
+ }
36
+
37
+ div.stDownloadButton > button:first-child:hover {
38
+ background: linear-gradient(135deg, #3ED83E 0%, #4169E1 100%);
39
+ transform: translateY(-2px) !important;
40
+ box-shadow: 0 4px 8px rgba(0,0,0,0.3) !important;
41
+ border: 2px solid black !important;
42
+ }
43
+
44
+ /* Special styling for download buttons in the webinar names container */
45
+ .webinar-names-container div.stDownloadButton > button:first-child {
46
+ background: linear-gradient(90deg, #FF5722, #FF9800); /* Orange gradient */
47
+ color: white;
48
+ font-weight: bold;
49
+ border: 1px solid black;
50
+ }
51
+
52
+ .webinar-names-container div.stDownloadButton > button:first-child:hover {
53
+ background: linear-gradient(135deg, #FF7043, #FFA726);
54
+ transform: translateY(-2px) !important;
55
+ box-shadow: 0 4px 8px rgba(0,0,0,0.3) !important;
56
+ border: 2px solid black !important;
57
+ }
58
+
59
+
60
+ /* Reduce top spacing and hide unnecessary elements */
61
+ .block-container {
62
+ padding-top: 1rem;
63
+ padding-bottom: 0rem;
64
+ }
65
+
66
+ header {
67
+ visibility: hidden;
68
+ }
69
+
70
+ #MainMenu {
71
+ visibility: hidden;
72
+ }
73
+
74
+ footer {
75
+ visibility: hidden;
76
+ }
77
+
78
+ /* Add any other custom styles here */
79
+
80
+
81
+ /* Styles for the webinar names container in the second tab */
82
+ .webinar-names-container {
83
+ padding: 15px;
84
+ margin-top: 10px;
85
+ margin-bottom: 10px;
86
+ }
87
+
88
+ /* Add border to all webinar name containers */
89
+ .webinar-names-container.with-border {
90
+ border: 1px solid #ddd;
91
+ border-radius: 5px;
92
+ padding: 20px;
93
+ }
94
+
95
+ /* Additional styling for containers with many items */
96
+ .webinar-names-container.many-items .stDownloadButton {
97
+ margin-top: 15px;
98
+ margin-bottom: 15px;
99
  }