Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -75,9 +75,17 @@ Create an opening paragraph for a {text_type} of {length} words in Spanish that
|
|
75 |
# Inicializar la aplicación Streamlit
|
76 |
st.set_page_config(page_title="First Line Alchemy", layout="wide")
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
# Centrar el título y el subtítulo
|
79 |
st.markdown("<h1 style='text-align: center;'>First Line Alchemy</h1>", unsafe_allow_html=True)
|
80 |
-
st.markdown("<
|
81 |
|
82 |
# Añadir CSS personalizado para el botón
|
83 |
st.markdown("""
|
@@ -110,15 +118,15 @@ with col1:
|
|
110 |
target_audience = st.text_input("¿Quién es tu público objetivo?")
|
111 |
product = st.text_input("¿Qué producto tienes en mente?")
|
112 |
|
113 |
-
#
|
114 |
-
with st.expander("Personaliza tu párrafo de apertura", expanded=st.session_state
|
115 |
text_type = st.selectbox("Tipo de texto", ["Historia", "Carta de venta", "Correo", "Landing page"])
|
116 |
length = st.slider("Número de palabras", min_value=50, max_value=200, value=100)
|
117 |
mood = st.selectbox("Tono de voz", ["Conversacional", "Formal", "Persuasivo"])
|
118 |
emotionality = st.selectbox("Emocionalidad del texto", ["Triste", "Feliz", "Horror", "Comedia", "Romántico", "Sorpresa", "Desesperación", "Esperanza", "Ira", "Confianza"])
|
119 |
|
120 |
# Submit button
|
121 |
-
submit = st.button("Escribir mi Texto")
|
122 |
|
123 |
# Button to generate text (outside the accordion)
|
124 |
if submit:
|
|
|
75 |
# Inicializar la aplicación Streamlit
|
76 |
st.set_page_config(page_title="First Line Alchemy", layout="wide")
|
77 |
|
78 |
+
# Inicializar el estado de la expansión del acordeón
|
79 |
+
if "accordion_expanded" not in st.session_state:
|
80 |
+
st.session_state["accordion_expanded"] = False # Por defecto está cerrado
|
81 |
+
|
82 |
+
# Definir una función para manejar el cambio de estado del acordeón
|
83 |
+
def toggle_accordion():
|
84 |
+
st.session_state["accordion_expanded"] = not st.session_state["accordion_expanded"]
|
85 |
+
|
86 |
# Centrar el título y el subtítulo
|
87 |
st.markdown("<h1 style='text-align: center;'>First Line Alchemy</h1>", unsafe_allow_html=True)
|
88 |
+
st.markdown("<h4 style='text-align: center;'>Experimenta la magia de transformar conceptos ordinarios en líneas de apertura extraordinarias que cautivan la imaginación e inspiran acción.</h4>", unsafe_allow_html=True)
|
89 |
|
90 |
# Añadir CSS personalizado para el botón
|
91 |
st.markdown("""
|
|
|
118 |
target_audience = st.text_input("¿Quién es tu público objetivo?")
|
119 |
product = st.text_input("¿Qué producto tienes en mente?")
|
120 |
|
121 |
+
# Accordion for customizing the opening paragraph, controlled by session_state
|
122 |
+
with st.expander("Personaliza tu párrafo de apertura", expanded=st.session_state["accordion_expanded"]):
|
123 |
text_type = st.selectbox("Tipo de texto", ["Historia", "Carta de venta", "Correo", "Landing page"])
|
124 |
length = st.slider("Número de palabras", min_value=50, max_value=200, value=100)
|
125 |
mood = st.selectbox("Tono de voz", ["Conversacional", "Formal", "Persuasivo"])
|
126 |
emotionality = st.selectbox("Emocionalidad del texto", ["Triste", "Feliz", "Horror", "Comedia", "Romántico", "Sorpresa", "Desesperación", "Esperanza", "Ira", "Confianza"])
|
127 |
|
128 |
# Submit button
|
129 |
+
submit = st.button("Escribir mi Texto", on_click=toggle_accordion)
|
130 |
|
131 |
# Button to generate text (outside the accordion)
|
132 |
if submit:
|