Update modules/studentact/current_situation_interface.py
Browse files
modules/studentact/current_situation_interface.py
CHANGED
@@ -37,19 +37,19 @@ def display_current_situation_interface(lang_code, nlp_models, t):
|
|
37 |
"""
|
38 |
Interfaz simplificada con gráfico de radar para visualizar métricas.
|
39 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
try:
|
41 |
-
# Inicializar estados si no existen
|
42 |
-
if 'text_input' not in st.session_state:
|
43 |
-
st.session_state.text_input = ""
|
44 |
-
if 'show_results' not in st.session_state:
|
45 |
-
st.session_state.show_results = False
|
46 |
-
if 'current_doc' not in st.session_state:
|
47 |
-
st.session_state.current_doc = None
|
48 |
-
if 'current_metrics' not in st.session_state:
|
49 |
-
st.session_state.current_metrics = None
|
50 |
-
|
51 |
-
st.markdown("## Análisis Inicial de Escritura")
|
52 |
-
|
53 |
# Container principal con dos columnas
|
54 |
with st.container():
|
55 |
input_col, results_col = st.columns([1,2])
|
@@ -105,13 +105,17 @@ def display_current_situation_interface(lang_code, nlp_models, t):
|
|
105 |
if st.session_state.show_results and st.session_state.current_metrics is not None:
|
106 |
display_results(st.session_state.current_metrics)
|
107 |
|
|
|
|
|
|
|
|
|
108 |
def display_results(metrics):
|
109 |
"""
|
110 |
Muestra los resultados del análisis: métricas y gráfico radar.
|
111 |
"""
|
112 |
try:
|
113 |
# Métricas en una fila con columnas uniformes
|
114 |
-
metric_cols = st.columns(4, gap="small"
|
115 |
|
116 |
metrics_config = [
|
117 |
("Vocabulario", metrics['vocabulary']['normalized_score'], "Riqueza y variedad del vocabulario"),
|
|
|
37 |
"""
|
38 |
Interfaz simplificada con gráfico de radar para visualizar métricas.
|
39 |
"""
|
40 |
+
# Inicializar estados si no existen
|
41 |
+
if 'text_input' not in st.session_state:
|
42 |
+
st.session_state.text_input = ""
|
43 |
+
if 'show_results' not in st.session_state:
|
44 |
+
st.session_state.show_results = False
|
45 |
+
if 'current_doc' not in st.session_state:
|
46 |
+
st.session_state.current_doc = None
|
47 |
+
if 'current_metrics' not in st.session_state:
|
48 |
+
st.session_state.current_metrics = None
|
49 |
+
|
50 |
+
st.markdown("## Análisis Inicial de Escritura")
|
51 |
+
|
52 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
# Container principal con dos columnas
|
54 |
with st.container():
|
55 |
input_col, results_col = st.columns([1,2])
|
|
|
105 |
if st.session_state.show_results and st.session_state.current_metrics is not None:
|
106 |
display_results(st.session_state.current_metrics)
|
107 |
|
108 |
+
except Exception as e:
|
109 |
+
logger.error(f"Error en interfaz principal: {str(e)}")
|
110 |
+
st.error("Ocurrió un error al cargar la interfaz")
|
111 |
+
|
112 |
def display_results(metrics):
|
113 |
"""
|
114 |
Muestra los resultados del análisis: métricas y gráfico radar.
|
115 |
"""
|
116 |
try:
|
117 |
# Métricas en una fila con columnas uniformes
|
118 |
+
metric_cols = st.columns(4, gap="small")
|
119 |
|
120 |
metrics_config = [
|
121 |
("Vocabulario", metrics['vocabulary']['normalized_score'], "Riqueza y variedad del vocabulario"),
|