Spaces:
Sleeping
Sleeping
Update modules/morphosyntax/morphosyntax_interface.py
Browse files
modules/morphosyntax/morphosyntax_interface.py
CHANGED
|
@@ -94,6 +94,7 @@ def display_morphosyntax_interface(lang_code, nlp_models, morpho_t):
|
|
| 94 |
|
| 95 |
# Contenedor para visualizaciones
|
| 96 |
diagram_container = st.container()
|
|
|
|
| 97 |
|
| 98 |
# Procesar texto original
|
| 99 |
if analyze_button and text_input.strip():
|
|
@@ -108,7 +109,8 @@ def display_morphosyntax_interface(lang_code, nlp_models, morpho_t):
|
|
| 108 |
'original_text': text_input,
|
| 109 |
'original_analysis': {'doc': doc, 'analysis': analysis},
|
| 110 |
'iteration_text': text_input,
|
| 111 |
-
'show_original': True
|
|
|
|
| 112 |
})
|
| 113 |
|
| 114 |
if store_student_morphosyntax_result(
|
|
@@ -123,10 +125,12 @@ def display_morphosyntax_interface(lang_code, nlp_models, morpho_t):
|
|
| 123 |
lang_code,
|
| 124 |
morpho_t
|
| 125 |
)
|
|
|
|
|
|
|
|
|
|
| 126 |
|
| 127 |
-
#
|
| 128 |
-
if st.session_state.morpho_state
|
| 129 |
-
iteration_container = st.container()
|
| 130 |
with iteration_container:
|
| 131 |
st.markdown("---")
|
| 132 |
iteration_key = f"iteration_{st.session_state.morpho_state['analysis_count']}"
|
|
@@ -164,7 +168,6 @@ def display_morphosyntax_interface(lang_code, nlp_models, morpho_t):
|
|
| 164 |
text=iteration_text,
|
| 165 |
arc_diagrams=analysis_iter['arc_diagrams']
|
| 166 |
):
|
| 167 |
-
# Redibujar ambos diagramas
|
| 168 |
with diagram_container:
|
| 169 |
st.empty() # Limpiar contenedor
|
| 170 |
|
|
@@ -194,8 +197,6 @@ def display_morphosyntax_interface(lang_code, nlp_models, morpho_t):
|
|
| 194 |
st.error("Error general en la interfaz")
|
| 195 |
logger.error(f"Error: {str(e)}")
|
| 196 |
|
| 197 |
-
|
| 198 |
-
|
| 199 |
############################################################################
|
| 200 |
|
| 201 |
def display_morphosyntax_results(result, lang_code, morpho_t):
|
|
|
|
| 94 |
|
| 95 |
# Contenedor para visualizaciones
|
| 96 |
diagram_container = st.container()
|
| 97 |
+
iteration_container = st.container()
|
| 98 |
|
| 99 |
# Procesar texto original
|
| 100 |
if analyze_button and text_input.strip():
|
|
|
|
| 109 |
'original_text': text_input,
|
| 110 |
'original_analysis': {'doc': doc, 'analysis': analysis},
|
| 111 |
'iteration_text': text_input,
|
| 112 |
+
'show_original': True,
|
| 113 |
+
'analysis_count': st.session_state.morpho_state['analysis_count'] + 1
|
| 114 |
})
|
| 115 |
|
| 116 |
if store_student_morphosyntax_result(
|
|
|
|
| 125 |
lang_code,
|
| 126 |
morpho_t
|
| 127 |
)
|
| 128 |
+
except Exception as e:
|
| 129 |
+
st.error("Error al procesar texto original")
|
| 130 |
+
logger.error(f"Error: {str(e)}")
|
| 131 |
|
| 132 |
+
# Mostrar secci贸n de iteraci贸n si hay an谩lisis original
|
| 133 |
+
if st.session_state.morpho_state.get('show_original', False):
|
|
|
|
| 134 |
with iteration_container:
|
| 135 |
st.markdown("---")
|
| 136 |
iteration_key = f"iteration_{st.session_state.morpho_state['analysis_count']}"
|
|
|
|
| 168 |
text=iteration_text,
|
| 169 |
arc_diagrams=analysis_iter['arc_diagrams']
|
| 170 |
):
|
|
|
|
| 171 |
with diagram_container:
|
| 172 |
st.empty() # Limpiar contenedor
|
| 173 |
|
|
|
|
| 197 |
st.error("Error general en la interfaz")
|
| 198 |
logger.error(f"Error: {str(e)}")
|
| 199 |
|
|
|
|
|
|
|
| 200 |
############################################################################
|
| 201 |
|
| 202 |
def display_morphosyntax_results(result, lang_code, morpho_t):
|