AIdeaText commited on
Commit
5f1328a
1 Parent(s): 4f8d08e

Update modules/ui.py

Browse files
Files changed (1) hide show
  1. modules/ui.py +9 -1
modules/ui.py CHANGED
@@ -233,20 +233,28 @@ def display_morphosyntax_analysis_interface(nlp_models, lang_code):
233
 
234
  t = translations[lang_code]
235
 
 
 
236
  if 'input_text' not in st.session_state:
237
  st.session_state.input_text = ""
238
 
 
 
 
 
239
  sentence_input = st.text_area(
240
  t['input_label'],
241
  height=150,
242
  placeholder=t['input_placeholder'],
243
  value=st.session_state.input_text,
244
- key=f"text_input_{lang_code}"
 
245
  )
246
  st.session_state.input_text = sentence_input
247
 
248
  if st.button(t['analyze_button'], key=f"analyze_button_{lang_code}"):
249
  if sentence_input:
 
250
  doc = nlp_models[lang_code](sentence_input)
251
 
252
  word_colors = get_repeated_words_colors(doc)
 
233
 
234
  t = translations[lang_code]
235
 
236
+ input_key = f"morphosyntax_input_{lang_code}"
237
+
238
  if 'input_text' not in st.session_state:
239
  st.session_state.input_text = ""
240
 
241
+ # Función para actualizar el estado del input
242
+ def update_input():
243
+ st.session_state[input_key] = st.session_state[f"text_area_{lang_code}"]
244
+
245
  sentence_input = st.text_area(
246
  t['input_label'],
247
  height=150,
248
  placeholder=t['input_placeholder'],
249
  value=st.session_state.input_text,
250
+ key=f"text_input_{lang_code}",
251
+ on_change=update_input
252
  )
253
  st.session_state.input_text = sentence_input
254
 
255
  if st.button(t['analyze_button'], key=f"analyze_button_{lang_code}"):
256
  if sentence_input:
257
+ current_input = st.session_state[input.key]
258
  doc = nlp_models[lang_code](sentence_input)
259
 
260
  word_colors = get_repeated_words_colors(doc)