JeCabrera commited on
Commit
91c9bf5
·
verified ·
1 Parent(s): 4d4d977

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -47
app.py CHANGED
@@ -22,19 +22,29 @@ def display_generated_content(col, generated_content, content_type):
22
 
23
  # Determinar el tipo de contenido para personalizar los botones y títulos
24
  if content_type == "script":
25
- download_label = "DESCARGAR GUION DE MI WEBINAR ▶▶"
26
- file_name = f"guion_webinar_{timestamp}.md"
27
  subheader_text = "Tu guión de webinar:"
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/markdown",
34
  key=f"download_top_{content_type}"
35
  )
36
  else: # nombres
 
 
37
  subheader_text = "Tus nombres de webinar:"
 
 
 
 
 
 
 
 
38
 
39
  # Mostrar el contenido generado
40
  col.subheader(subheader_text)
@@ -46,7 +56,7 @@ def display_generated_content(col, generated_content, content_type):
46
  label=download_label,
47
  data=generated_content,
48
  file_name=file_name,
49
- mime="text/markdown",
50
  key=f"download_bottom_{content_type}"
51
  )
52
 
@@ -494,46 +504,4 @@ with tab2:
494
  content_type="names",
495
  number_of_names=number_of_names,
496
  selected_angle=selected_angle if selected_angle != "NINGUNO" else None
497
- )
498
-
499
- # In the generate_and_display function, where the download functionality is implemented
500
-
501
- def generate_and_display(col, generator_func, audience, product, temperature, selected_formula, content_type, offer=None, creative_idea=None):
502
- # ... existing code ...
503
-
504
- # Display the generated content
505
- with col:
506
- if content_type == "script":
507
- st.markdown(f"## Tu guión de webinar:")
508
- st.markdown(generated_content)
509
-
510
- # Create download content with timestamp
511
- timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
512
- download_content = generated_content
513
-
514
- # Download button
515
- st.download_button(
516
- label="DESCARGAR GUIÓN DE WEBINAR",
517
- data=download_content,
518
- file_name=f"guion_webinar_{timestamp}.txt",
519
- mime="text/plain"
520
- )
521
-
522
- elif content_type == "names":
523
- st.markdown(f"## Nombres para tu webinar:")
524
- st.markdown(generated_content)
525
-
526
- # Create download content with timestamp
527
- timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
528
- download_content = generated_content
529
-
530
- # Download button
531
- st.download_button(
532
- label="DESCARGAR NOMBRES DE WEBINAR",
533
- data=download_content,
534
- file_name=f"nombres_webinar_{timestamp}.txt",
535
- mime="text/plain"
536
- )
537
-
538
- # ... existing code ...
539
-
 
22
 
23
  # Determinar el tipo de contenido para personalizar los botones y títulos
24
  if content_type == "script":
25
+ download_label = "DESCARGAR GUIÓN DE WEBINAR ▶▶"
26
+ file_name = f"guion_webinar_{timestamp}.txt"
27
  subheader_text = "Tu guión de webinar:"
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
  else: # nombres
37
+ download_label = "DESCARGAR NOMBRES DE WEBINAR ▶▶"
38
+ file_name = f"nombres_webinar_{timestamp}.txt"
39
  subheader_text = "Tus nombres de webinar:"
40
+ # Añadir botón de descarga para nombres de webinar
41
+ col.download_button(
42
+ label=download_label,
43
+ data=generated_content,
44
+ file_name=file_name,
45
+ mime="text/plain",
46
+ key=f"download_top_{content_type}"
47
+ )
48
 
49
  # Mostrar el contenido generado
50
  col.subheader(subheader_text)
 
56
  label=download_label,
57
  data=generated_content,
58
  file_name=file_name,
59
+ mime="text/plain",
60
  key=f"download_bottom_{content_type}"
61
  )
62
 
 
504
  content_type="names",
505
  number_of_names=number_of_names,
506
  selected_angle=selected_angle if selected_angle != "NINGUNO" else None
507
+ )