JeCabrera commited on
Commit
754681a
·
verified ·
1 Parent(s): 4fd2ba7

Upload 12 files

Browse files
Files changed (2) hide show
  1. app.py +20 -23
  2. styles/styles.css +147 -115
app.py CHANGED
@@ -57,34 +57,31 @@ def display_generated_content(col, generated_content, content_type):
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):
 
57
  # Determinar si hay más de 5 nombres para mostrar los botones de descarga
58
  has_many_items = num_names > 5
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  # Mostrar el contenido generado
61
  col.subheader(subheader_text)
62
  col.markdown(generated_content)
63
 
64
+ # Para los nombres, usar HTML personalizado en lugar de st.download_button
65
  if has_many_items:
66
+ import base64
67
+
68
+ # Codificar el contenido para descarga
69
+ b64 = base64.b64encode(generated_content.encode()).decode()
70
+
71
+ # Crear botón de descarga personalizado con HTML y CSS
72
+ custom_download_html = f"""
73
+ <div class="custom-download-button names-download-button">
74
+ <a href="data:text/plain;base64,{b64}" download="{file_name}" style="text-decoration:none; color:white; display:block; width:100%; text-align:center;">
75
+ {download_label}
76
+ </a>
77
+ </div>
78
+ """
79
+
80
+ # Mostrar botón de descarga superior
81
+ col.markdown(custom_download_html, unsafe_allow_html=True)
82
+
83
+ # Mostrar botón de descarga inferior
84
+ col.markdown(custom_download_html, unsafe_allow_html=True)
85
 
86
  # Implementar la función generate_and_display para reemplazar código duplicado
87
  def generate_and_display(col, generator_func, audience, product, temperature, selected_formula, content_type, **kwargs):
styles/styles.css CHANGED
@@ -1,116 +1,148 @@
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
- }
100
-
101
- /* Special styling for download buttons in the webinar names tab */
102
- div.stDownloadButton[data-testid*="download_top_names"] > button:first-child,
103
- div.stDownloadButton[data-testid*="download_bottom_names"] > button:first-child {
104
- background: linear-gradient(90deg, #FF5722, #FF9800) !important; /* Orange gradient */
105
- color: white !important;
106
- font-weight: bold !important;
107
- border: 1px solid black !important;
108
- }
109
-
110
- div.stDownloadButton[data-testid*="download_top_names"] > button:first-child:hover,
111
- div.stDownloadButton[data-testid*="download_bottom_names"] > button:first-child:hover {
112
- background: linear-gradient(135deg, #FF7043, #FFA726) !important;
113
- transform: translateY(-2px) !important;
114
- box-shadow: 0 4px 8px rgba(0,0,0,0.3) !important;
115
- border: 2px solid black !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  }
 
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
+ }
100
+
101
+ /* Special styling for download buttons in the webinar names tab */
102
+ div.stDownloadButton[data-testid*="download_top_names"] > button:first-child,
103
+ div.stDownloadButton[data-testid*="download_bottom_names"] > button:first-child {
104
+ background: linear-gradient(90deg, #FF5722, #FF9800) !important; /* Orange gradient */
105
+ color: white !important;
106
+ font-weight: bold !important;
107
+ border: 1px solid black !important;
108
+ }
109
+
110
+ div.stDownloadButton[data-testid*="download_top_names"] > button:first-child:hover,
111
+ div.stDownloadButton[data-testid*="download_bottom_names"] > button:first-child:hover {
112
+ background: linear-gradient(135deg, #FF7043, #FFA726) !important;
113
+ transform: translateY(-2px) !important;
114
+ box-shadow: 0 4px 8px rgba(0,0,0,0.3) !important;
115
+ border: 2px solid black !important;
116
+ }
117
+
118
+
119
+ /* Custom download button for names tab */
120
+ .custom-download-button.names-download-button {
121
+ background: linear-gradient(90deg, #FF5722, #FF9800); /* Orange gradient */
122
+ color: white;
123
+ font-weight: bold;
124
+ padding: 0.75rem 1rem;
125
+ border-radius: 5px;
126
+ border: 1px solid #333;
127
+ text-align: center;
128
+ margin: 15px auto;
129
+ width: 80%;
130
+ cursor: pointer;
131
+ transition: all 0.3s;
132
+ }
133
+
134
+ .custom-download-button.names-download-button:hover {
135
+ background: linear-gradient(135deg, #FF7043, #FFA726);
136
+ transform: translateY(-2px);
137
+ box-shadow: 0 4px 8px rgba(0,0,0,0.3);
138
+ border: 2px solid #333;
139
+ }
140
+
141
+ /* Make sure links inside the button inherit the text color */
142
+ .custom-download-button.names-download-button a {
143
+ color: white !important;
144
+ display: block;
145
+ width: 100%;
146
+ height: 100%;
147
+ font-weight: bold;
148
  }