Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -74,53 +74,55 @@ st.set_page_config(page_title="Generador de Historias", page_icon=":pencil:", la
|
|
| 74 |
st.markdown("<h1 style='text-align: center;'>Generador de Historias</h1>", unsafe_allow_html=True)
|
| 75 |
st.markdown("<h3 style='text-align: center;'>Crea historias persuasivas con inteligencia artificial, diseñadas para conectar emocionalmente con tu audiencia.</h3>", unsafe_allow_html=True)
|
| 76 |
|
| 77 |
-
# Crear
|
| 78 |
-
|
| 79 |
-
st.write("Genera una historia siguiendo la estructura P.A.S.A. para resolver un problema de tu audiencia.")
|
| 80 |
-
target_audience = st.text_input("Público objetivo", placeholder="¿A quién está dirigido tu mensaje?")
|
| 81 |
-
product = st.text_input("Producto/Servicio", placeholder="¿Qué estás ofreciendo?")
|
| 82 |
-
action = st.text_area("Llamado a la acción", placeholder="¿Qué acción específica debe tomar tu audiencia?")
|
| 83 |
-
mood = st.selectbox("Tono de la historia:", ["Emocional", "Triste", "Feliz", "Horror", "Comedia", "Romántico"])
|
| 84 |
-
length = st.slider("Longitud de la historia (palabras):", min_value=50, max_value=150, value=100, step=10)
|
| 85 |
|
| 86 |
-
|
| 87 |
-
|
| 88 |
target_audience = st.text_input("Público objetivo", placeholder="¿A quién está dirigido tu mensaje?")
|
| 89 |
product = st.text_input("Producto/Servicio", placeholder="¿Qué estás ofreciendo?")
|
| 90 |
action = st.text_area("Llamado a la acción", placeholder="¿Qué acción específica debe tomar tu audiencia?")
|
| 91 |
-
mood = st.selectbox("Tono de la historia:", ["Emocional", "Triste", "Feliz", "Horror", "Comedia", "Romántico"])
|
| 92 |
-
length = st.slider("Longitud de la historia (palabras):", min_value=50, max_value=150, value=100, step=10)
|
| 93 |
|
| 94 |
-
|
| 95 |
-
st.
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
st.
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
st.markdown("<h1 style='text-align: center;'>Generador de Historias</h1>", unsafe_allow_html=True)
|
| 75 |
st.markdown("<h3 style='text-align: center;'>Crea historias persuasivas con inteligencia artificial, diseñadas para conectar emocionalmente con tu audiencia.</h3>", unsafe_allow_html=True)
|
| 76 |
|
| 77 |
+
# Crear las columnas para el diseño (40% para la izquierda, 60% para la derecha)
|
| 78 |
+
col1, col2 = st.columns([2, 3])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
+
# Entradas del usuario en la columna izquierda (col1)
|
| 81 |
+
with col1:
|
| 82 |
target_audience = st.text_input("Público objetivo", placeholder="¿A quién está dirigido tu mensaje?")
|
| 83 |
product = st.text_input("Producto/Servicio", placeholder="¿Qué estás ofreciendo?")
|
| 84 |
action = st.text_area("Llamado a la acción", placeholder="¿Qué acción específica debe tomar tu audiencia?")
|
|
|
|
|
|
|
| 85 |
|
| 86 |
+
# Personalización adicional
|
| 87 |
+
with st.expander("Personaliza tu historia"):
|
| 88 |
+
mood = st.selectbox("Tono de la historia:", ["Emocional", "Triste", "Feliz", "Horror", "Comedia", "Romántico"])
|
| 89 |
+
length = st.slider("Longitud de la historia (palabras):", min_value=50, max_value=150, value=100, step=10)
|
| 90 |
+
|
| 91 |
+
# Crear acordeón con las tres fórmulas
|
| 92 |
+
with st.expander("P.A.S.A."):
|
| 93 |
+
# Entrada adicional si es necesario para P.A.S.A.
|
| 94 |
+
pass
|
| 95 |
+
|
| 96 |
+
with st.expander("A.D.P."):
|
| 97 |
+
# Entrada adicional si es necesario para A.D.P.
|
| 98 |
+
pass
|
| 99 |
+
|
| 100 |
+
with st.expander("G.H.A."):
|
| 101 |
+
story_topic = st.text_area("De qué quieres que trate la historia", placeholder="Explica si hay algo específico sobre lo que te gustaría contar (puede ser una vivencia personal, película, cuento, personaje ficticio, etc.).")
|
| 102 |
+
|
| 103 |
+
# Botón para generar contenido
|
| 104 |
+
submit = st.button("Generar mi historia")
|
| 105 |
+
|
| 106 |
+
# Mostrar el contenido generado en la columna derecha (col2)
|
| 107 |
+
with col2:
|
| 108 |
+
if submit:
|
| 109 |
+
if target_audience and product and action:
|
| 110 |
+
try:
|
| 111 |
+
if "P.A.S.A." in st.expander("P.A.S.A.").expanded:
|
| 112 |
+
response = get_pasa_response(target_audience, product, action, mood, length)
|
| 113 |
+
elif "A.D.P." in st.expander("A.D.P.").expanded:
|
| 114 |
+
response = get_adp_response(target_audience, product, action, mood, length)
|
| 115 |
+
elif "G.H.A." in st.expander("G.H.A.").expanded:
|
| 116 |
+
if story_topic:
|
| 117 |
+
response = get_gha_response(target_audience, product, action, mood, length, story_topic)
|
| 118 |
+
else:
|
| 119 |
+
st.error("Por favor, completa todos los campos requeridos para la fórmula G.H.A.")
|
| 120 |
+
response = ""
|
| 121 |
+
|
| 122 |
+
if response:
|
| 123 |
+
st.subheader("Historia generada:")
|
| 124 |
+
st.write(response)
|
| 125 |
+
except ValueError as e:
|
| 126 |
+
st.error(f"Error: {str(e)}")
|
| 127 |
+
else:
|
| 128 |
+
st.error("Por favor, completa todos los campos requeridos (Público objetivo, Producto y Acción).")
|