AIdeaText commited on
Commit
93139d2
1 Parent(s): 177160f

Update modules/ui/ui.py

Browse files
Files changed (1) hide show
  1. modules/ui/ui.py +19 -7
modules/ui/ui.py CHANGED
@@ -825,6 +825,25 @@ def display_semantic_analysis_interface(nlp_models, lang_code):
825
  # Realizar el análisis
826
  analysis_result = perform_semantic_analysis(text_content, nlp_models[lang_code], lang_code)
827
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
828
  def display_semantic_results(result, lang_code, t):
829
  # Mostrar conceptos clave
830
  with st.expander(t['key_concepts'], expanded=True):
@@ -835,13 +854,6 @@ def display_semantic_results(result, lang_code, t):
835
  with st.expander(t['conceptual_relations'], expanded=True):
836
  st.pyplot(analysis_result['relations_graph'])
837
 
838
- # Guardar el resultado del análisis
839
- if store_semantic_result(st.session_state.username, text_content, analysis_result):
840
- st.success(t['success_message'])
841
- else:
842
- st.error(t['error_message'])
843
- else:
844
- st.warning(t['warning_message'])
845
  ##################################################################################################
846
  def display_discourse_analysis_interface(nlp_models, lang_code):
847
  translations = {
 
825
  # Realizar el análisis
826
  analysis_result = perform_semantic_analysis(text_content, nlp_models[lang_code], lang_code)
827
 
828
+ # Guardar el resultado en el estado de la sesión
829
+ st.session_state.semantic_result = analysis_result
830
+
831
+ # Mostrar resultados
832
+ display_semantic_results(st.session_state.semantic_result, lang_code, t)
833
+
834
+ # Guardar el resultado del análisis
835
+ if store_semantic_result(st.session_state.username, text_content, analysis_result):
836
+ st.success(t['success_message'])
837
+ else:
838
+ st.error(t['error_message'])
839
+ else:
840
+ st.warning(t['warning_message'])
841
+
842
+ elif 'semantic_result' in st.session_state:
843
+
844
+ # Si hay un resultado guardado, mostrarlo
845
+ display_semantic_results(st.session_state.semantic_result, lang_code, t)
846
+
847
  def display_semantic_results(result, lang_code, t):
848
  # Mostrar conceptos clave
849
  with st.expander(t['key_concepts'], expanded=True):
 
854
  with st.expander(t['conceptual_relations'], expanded=True):
855
  st.pyplot(analysis_result['relations_graph'])
856
 
 
 
 
 
 
 
 
857
  ##################################################################################################
858
  def display_discourse_analysis_interface(nlp_models, lang_code):
859
  translations = {