Spaces:
Sleeping
Sleeping
Upload 12 files
Browse files- app.py +40 -1
- styles/styles.css +22 -1
app.py
CHANGED
|
@@ -35,12 +35,39 @@ def display_generated_content(col, generated_content, content_type):
|
|
| 35 |
)
|
| 36 |
else: # nombres
|
| 37 |
subheader_text = "Tus nombres de webinar:"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
# Mostrar el contenido generado
|
| 40 |
col.subheader(subheader_text)
|
| 41 |
col.markdown(generated_content)
|
| 42 |
|
| 43 |
-
# Mostrar botón de descarga inferior
|
| 44 |
if content_type == "script":
|
| 45 |
col.download_button(
|
| 46 |
label=download_label,
|
|
@@ -49,6 +76,18 @@ def display_generated_content(col, generated_content, content_type):
|
|
| 49 |
mime="text/plain",
|
| 50 |
key=f"download_bottom_{content_type}"
|
| 51 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
# Implementar la función generate_and_display para reemplazar código duplicado
|
| 54 |
def generate_and_display(col, generator_func, audience, product, temperature, selected_formula, content_type, **kwargs):
|
|
|
|
| 35 |
)
|
| 36 |
else: # nombres
|
| 37 |
subheader_text = "Tus nombres de webinar:"
|
| 38 |
+
file_name = f"nombres_webinar_{timestamp}.txt"
|
| 39 |
+
download_label = "DESCARGAR NOMBRES DE WEBINAR ▶▶"
|
| 40 |
+
|
| 41 |
+
# Contar el número de nombres generados (aproximadamente por el número de líneas)
|
| 42 |
+
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.'))])
|
| 43 |
+
|
| 44 |
+
# Determinar si hay más de 5 nombres para mostrar los botones de descarga
|
| 45 |
+
has_many_items = num_names > 5
|
| 46 |
+
|
| 47 |
+
# Crear un contenedor con las clases adecuadas - Siempre aplicar el borde
|
| 48 |
+
container_classes = "webinar-names-container with-border"
|
| 49 |
+
if has_many_items:
|
| 50 |
+
container_classes += " many-items"
|
| 51 |
+
|
| 52 |
+
# Abrir el contenedor con las clases
|
| 53 |
+
col.markdown(f'<div class="{container_classes}">', unsafe_allow_html=True)
|
| 54 |
+
|
| 55 |
+
# Mostrar botón de descarga superior solo si hay más de 5 nombres
|
| 56 |
+
if has_many_items:
|
| 57 |
+
col.download_button(
|
| 58 |
+
label=download_label,
|
| 59 |
+
data=generated_content,
|
| 60 |
+
file_name=file_name,
|
| 61 |
+
mime="text/plain",
|
| 62 |
+
key=f"download_top_{content_type}",
|
| 63 |
+
help="Descargar todos los nombres generados"
|
| 64 |
+
)
|
| 65 |
|
| 66 |
# Mostrar el contenido generado
|
| 67 |
col.subheader(subheader_text)
|
| 68 |
col.markdown(generated_content)
|
| 69 |
|
| 70 |
+
# Mostrar botón de descarga inferior
|
| 71 |
if content_type == "script":
|
| 72 |
col.download_button(
|
| 73 |
label=download_label,
|
|
|
|
| 76 |
mime="text/plain",
|
| 77 |
key=f"download_bottom_{content_type}"
|
| 78 |
)
|
| 79 |
+
elif has_many_items: # Mostrar botón inferior solo para nombres si hay más de 5
|
| 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 |
+
# Cerrar el contenedor div
|
| 90 |
+
col.markdown('</div>', unsafe_allow_html=True)
|
| 91 |
|
| 92 |
# Implementar la función generate_and_display para reemplazar código duplicado
|
| 93 |
def generate_and_display(col, generator_func, audience, product, temperature, selected_formula, content_type, **kwargs):
|
styles/styles.css
CHANGED
|
@@ -60,4 +60,25 @@ footer {
|
|
| 60 |
visibility: hidden;
|
| 61 |
}
|
| 62 |
|
| 63 |
-
/* Add any other custom styles here */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
visibility: hidden;
|
| 61 |
}
|
| 62 |
|
| 63 |
+
/* Add any other custom styles here */
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
/* Styles for the webinar names container in the second tab */
|
| 67 |
+
.webinar-names-container {
|
| 68 |
+
padding: 15px;
|
| 69 |
+
margin-top: 10px;
|
| 70 |
+
margin-bottom: 10px;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
/* Add border to all webinar name containers */
|
| 74 |
+
.webinar-names-container.with-border {
|
| 75 |
+
border: 1px solid #ddd;
|
| 76 |
+
border-radius: 5px;
|
| 77 |
+
padding: 20px;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
/* Additional styling for containers with many items */
|
| 81 |
+
.webinar-names-container.many-items .stDownloadButton {
|
| 82 |
+
margin-top: 15px;
|
| 83 |
+
margin-bottom: 15px;
|
| 84 |
+
}
|