Spaces:
Sleeping
Sleeping
Update modules/studentact/current_situation_interface.py
Browse files
modules/studentact/current_situation_interface.py
CHANGED
|
@@ -125,55 +125,14 @@ def display_current_situation_interface(lang_code, nlp_models, t):
|
|
| 125 |
# Mostrar resultados en la columna derecha
|
| 126 |
with results_col:
|
| 127 |
if st.session_state.show_results and st.session_state.current_metrics is not None:
|
| 128 |
-
|
| 129 |
-
with st.container():
|
| 130 |
-
st.markdown('<div class="metric-container">', unsafe_allow_html=True)
|
| 131 |
-
|
| 132 |
-
# Crear columnas para las m茅tricas con espaciado uniforme
|
| 133 |
-
c1, c2, c3, c4 = st.columns([1.2, 1.2, 1.2, 1.2])
|
| 134 |
-
|
| 135 |
-
with c1:
|
| 136 |
-
st.metric(
|
| 137 |
-
"Vocabulario",
|
| 138 |
-
f"{st.session_state.current_metrics['vocabulary']['normalized_score']:.2f}",
|
| 139 |
-
"Meta: 1.00",
|
| 140 |
-
delta_color="off",
|
| 141 |
-
help="Riqueza y variedad del vocabulario utilizado"
|
| 142 |
-
)
|
| 143 |
-
with c2:
|
| 144 |
-
st.metric(
|
| 145 |
-
"Estructura",
|
| 146 |
-
f"{st.session_state.current_metrics['structure']['normalized_score']:.2f}",
|
| 147 |
-
"Meta: 1.00",
|
| 148 |
-
delta_color="off",
|
| 149 |
-
help="Organizaci贸n y complejidad de las oraciones"
|
| 150 |
-
)
|
| 151 |
-
with c3:
|
| 152 |
-
st.metric(
|
| 153 |
-
"Cohesi贸n",
|
| 154 |
-
f"{st.session_state.current_metrics['cohesion']['normalized_score']:.2f}",
|
| 155 |
-
"Meta: 1.00",
|
| 156 |
-
delta_color="off",
|
| 157 |
-
help="Conexi贸n y fluidez entre ideas"
|
| 158 |
-
)
|
| 159 |
-
with c4:
|
| 160 |
-
st.metric(
|
| 161 |
-
"Claridad",
|
| 162 |
-
f"{st.session_state.current_metrics['clarity']['normalized_score']:.2f}",
|
| 163 |
-
"Meta: 1.00",
|
| 164 |
-
delta_color="off",
|
| 165 |
-
help="Facilidad de comprensi贸n del texto"
|
| 166 |
-
)
|
| 167 |
-
|
| 168 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
| 169 |
-
|
| 170 |
-
# Mostrar el gr谩fico de radar
|
| 171 |
-
display_radar_chart(st.session_state.current_metrics)
|
| 172 |
|
| 173 |
except Exception as e:
|
| 174 |
logger.error(f"Error en interfaz: {str(e)}")
|
| 175 |
st.error("Ocurri贸 un error. Por favor, intente de nuevo.")
|
| 176 |
|
|
|
|
|
|
|
| 177 |
def display_radar_chart(metrics):
|
| 178 |
"""
|
| 179 |
Muestra un gr谩fico de radar con las m茅tricas del usuario y el patr贸n ideal.
|
|
@@ -181,16 +140,45 @@ def display_radar_chart(metrics):
|
|
| 181 |
try:
|
| 182 |
# Container con proporci贸n reducida
|
| 183 |
with st.container():
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
|
| 195 |
# Contenedor para el gr谩fico con ancho controlado
|
| 196 |
_, graph_col, _ = st.columns([1,2,1])
|
|
|
|
| 125 |
# Mostrar resultados en la columna derecha
|
| 126 |
with results_col:
|
| 127 |
if st.session_state.show_results and st.session_state.current_metrics is not None:
|
| 128 |
+
display_radar_chart(st.session_state.current_metrics)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
|
| 130 |
except Exception as e:
|
| 131 |
logger.error(f"Error en interfaz: {str(e)}")
|
| 132 |
st.error("Ocurri贸 un error. Por favor, intente de nuevo.")
|
| 133 |
|
| 134 |
+
|
| 135 |
+
########################################
|
| 136 |
def display_radar_chart(metrics):
|
| 137 |
"""
|
| 138 |
Muestra un gr谩fico de radar con las m茅tricas del usuario y el patr贸n ideal.
|
|
|
|
| 140 |
try:
|
| 141 |
# Container con proporci贸n reducida
|
| 142 |
with st.container():
|
| 143 |
+
st.markdown('<div class="metric-container">', unsafe_allow_html=True)
|
| 144 |
+
|
| 145 |
+
# Crear columnas para las m茅tricas con espaciado uniforme
|
| 146 |
+
c1, c2, c3, c4 = st.columns([1.2, 1.2, 1.2, 1.2])
|
| 147 |
+
|
| 148 |
+
with c1:
|
| 149 |
+
st.metric(
|
| 150 |
+
"Vocabulario",
|
| 151 |
+
f"{metrics['vocabulary']['normalized_score']:.2f}",
|
| 152 |
+
"Meta: 1.00",
|
| 153 |
+
delta_color="off",
|
| 154 |
+
help="Riqueza y variedad del vocabulario utilizado"
|
| 155 |
+
)
|
| 156 |
+
with c2:
|
| 157 |
+
st.metric(
|
| 158 |
+
"Estructura",
|
| 159 |
+
f"{metrics['structure']['normalized_score']:.2f}",
|
| 160 |
+
"Meta: 1.00",
|
| 161 |
+
delta_color="off",
|
| 162 |
+
help="Organizaci贸n y complejidad de las oraciones"
|
| 163 |
+
)
|
| 164 |
+
with c3:
|
| 165 |
+
st.metric(
|
| 166 |
+
"Cohesi贸n",
|
| 167 |
+
f"{metrics['cohesion']['normalized_score']:.2f}",
|
| 168 |
+
"Meta: 1.00",
|
| 169 |
+
delta_color="off",
|
| 170 |
+
help="Conexi贸n y fluidez entre ideas"
|
| 171 |
+
)
|
| 172 |
+
with c4:
|
| 173 |
+
st.metric(
|
| 174 |
+
"Claridad",
|
| 175 |
+
f"{metrics['clarity']['normalized_score']:.2f}",
|
| 176 |
+
"Meta: 1.00",
|
| 177 |
+
delta_color="off",
|
| 178 |
+
help="Facilidad de comprensi贸n del texto"
|
| 179 |
+
)
|
| 180 |
+
|
| 181 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
| 182 |
|
| 183 |
# Contenedor para el gr谩fico con ancho controlado
|
| 184 |
_, graph_col, _ = st.columns([1,2,1])
|