JeCabrera commited on
Commit
5ee726f
·
verified ·
1 Parent(s): ab08c4d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -10
app.py CHANGED
@@ -185,9 +185,10 @@ with col1:
185
  generate_button = st.button("Generar Ideas Creativas")
186
 
187
  with st.expander("Opciones avanzadas"):
188
- # Replace text area with accordion for tone selection
189
  st.write("Tono de voz de la marca (opcional)")
190
  tone_options = {
 
191
  "Profesional": "A formal and expert tone that conveys authority and knowledge.",
192
  "Serio": "A direct and sober tone, focused on facts and results.",
193
  "Divertido": "A cheerful and positive tone that connects in a friendly way.",
@@ -195,17 +196,23 @@ with col1:
195
  "Humorístico": "A tone that uses humor to connect and entertain."
196
  }
197
 
198
- selected_tone = None
199
- for tone, description in tone_options.items():
200
- with st.expander(tone):
201
- st.write(description)
202
- if st.button(f"Seleccionar tono {tone}", key=f"tone_{tone}"):
203
- selected_tone = tone
 
204
 
205
- # Store the selected tone
206
- if selected_tone:
 
 
207
  st.session_state.selected_tone = selected_tone
208
- st.success(f"Tono seleccionado: {selected_tone}")
 
 
 
209
 
210
  # Use the stored tone or empty string
211
  tone_of_voice = st.session_state.get("selected_tone", "")
 
185
  generate_button = st.button("Generar Ideas Creativas")
186
 
187
  with st.expander("Opciones avanzadas"):
188
+ # Replace nested expanders with a selectbox for tone selection
189
  st.write("Tono de voz de la marca (opcional)")
190
  tone_options = {
191
+ "Ninguno": "Sin tono específico",
192
  "Profesional": "A formal and expert tone that conveys authority and knowledge.",
193
  "Serio": "A direct and sober tone, focused on facts and results.",
194
  "Divertido": "A cheerful and positive tone that connects in a friendly way.",
 
196
  "Humorístico": "A tone that uses humor to connect and entertain."
197
  }
198
 
199
+ # Use selectbox for tone selection
200
+ selected_tone = st.selectbox(
201
+ "Selecciona un tono:",
202
+ options=list(tone_options.keys()),
203
+ index=0,
204
+ key="tone_selectbox"
205
+ )
206
 
207
+ # Display the description of the selected tone
208
+ if selected_tone != "Ninguno":
209
+ st.info(tone_options[selected_tone])
210
+ # Store the selected tone
211
  st.session_state.selected_tone = selected_tone
212
+ else:
213
+ # Clear any previously selected tone
214
+ if "selected_tone" in st.session_state:
215
+ del st.session_state.selected_tone
216
 
217
  # Use the stored tone or empty string
218
  tone_of_voice = st.session_state.get("selected_tone", "")