Spaces:
Running
Running
Update modules/studentact/current_situation_interface.py
Browse files
modules/studentact/current_situation_interface.py
CHANGED
|
@@ -90,7 +90,6 @@ ANALYSIS_DIMENSION_MAPPING = {
|
|
| 90 |
}
|
| 91 |
}
|
| 92 |
|
| 93 |
-
################################################################
|
| 94 |
##############################################################################
|
| 95 |
# FUNCIÓN PRINCIPAL
|
| 96 |
##############################################################################
|
|
@@ -215,11 +214,49 @@ def display_current_situation_interface(lang_code, nlp_models, t):
|
|
| 215 |
logger.error(f"Error en interfaz: {str(e)}")
|
| 216 |
st.error("Error al cargar la interfaz")
|
| 217 |
|
|
|
|
| 218 |
#Funciones de visualización ##################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
|
| 220 |
|
|
|
|
| 221 |
|
| 222 |
-
##################################################################
|
| 223 |
def display_metrics_analysis(metrics, text_type=None):
|
| 224 |
"""
|
| 225 |
Muestra los resultados del análisis: métricas verticalmente y gráfico radar.
|
|
|
|
| 90 |
}
|
| 91 |
}
|
| 92 |
|
|
|
|
| 93 |
##############################################################################
|
| 94 |
# FUNCIÓN PRINCIPAL
|
| 95 |
##############################################################################
|
|
|
|
| 214 |
logger.error(f"Error en interfaz: {str(e)}")
|
| 215 |
st.error("Error al cargar la interfaz")
|
| 216 |
|
| 217 |
+
|
| 218 |
#Funciones de visualización ##################################
|
| 219 |
+
##############################################################################
|
| 220 |
+
# Función para mostrar métricas en una sola fila
|
| 221 |
+
##############################################################################
|
| 222 |
+
def display_metrics_in_one_line(metrics, text_type):
|
| 223 |
+
"""
|
| 224 |
+
Muestra las cuatro dimensiones (Vocabulario, Estructura, Cohesión, Claridad)
|
| 225 |
+
en una sola línea, usando 4 columnas.
|
| 226 |
+
"""
|
| 227 |
+
thresholds = TEXT_TYPES[text_type]['thresholds']
|
| 228 |
+
dimensions = ["vocabulary", "structure", "cohesion", "clarity"]
|
| 229 |
+
|
| 230 |
+
col1, col2, col3, col4 = st.columns(4)
|
| 231 |
+
cols = [col1, col2, col3, col4]
|
| 232 |
+
|
| 233 |
+
for dim, col in zip(dimensions, cols):
|
| 234 |
+
score = metrics[dim]['normalized_score']
|
| 235 |
+
target = thresholds[dim]['target']
|
| 236 |
+
min_val = thresholds[dim]['min']
|
| 237 |
+
|
| 238 |
+
# Determinar estado y color
|
| 239 |
+
if score < min_val:
|
| 240 |
+
status = "⚠️ Por mejorar"
|
| 241 |
+
color = "inverse"
|
| 242 |
+
elif score < target:
|
| 243 |
+
status = "📈 Aceptable"
|
| 244 |
+
color = "off"
|
| 245 |
+
else:
|
| 246 |
+
status = "✅ Óptimo"
|
| 247 |
+
color = "normal"
|
| 248 |
+
|
| 249 |
+
with col:
|
| 250 |
+
col.metric(
|
| 251 |
+
label=dim.capitalize(),
|
| 252 |
+
value=f"{score:.2f}",
|
| 253 |
+
delta=f"{status} (Meta: {target:.2f})",
|
| 254 |
+
delta_color=color
|
| 255 |
+
)
|
| 256 |
|
| 257 |
|
| 258 |
+
####################################################################
|
| 259 |
|
|
|
|
| 260 |
def display_metrics_analysis(metrics, text_type=None):
|
| 261 |
"""
|
| 262 |
Muestra los resultados del análisis: métricas verticalmente y gráfico radar.
|