Spaces:
Sleeping
Sleeping
Update modules/studentact/current_situation_interface.py
Browse files
modules/studentact/current_situation_interface.py
CHANGED
|
@@ -159,45 +159,20 @@ def display_current_situation_interface(lang_code, nlp_models, t):
|
|
| 159 |
|
| 160 |
def display_results(metrics, text_type=None):
|
| 161 |
"""
|
| 162 |
-
|
| 163 |
-
Args:
|
| 164 |
-
metrics: Diccionario con las métricas del análisis
|
| 165 |
-
text_type: Tipo de texto (default: None)
|
| 166 |
"""
|
| 167 |
try:
|
| 168 |
# Usar valor por defecto si no se especifica tipo
|
| 169 |
text_type = text_type or 'student_essay'
|
| 170 |
|
| 171 |
-
# Obtener umbrales según el tipo de texto
|
| 172 |
-
thresholds = TEXT_TYPES[text_type]['thresholds']
|
| 173 |
-
'vocabulary': {'min': 0.60, 'target': 0.75},
|
| 174 |
-
'structure': {'min': 0.65, 'target': 0.80},
|
| 175 |
-
'cohesion': {'min': 0.55, 'target': 0.70},
|
| 176 |
-
'clarity': {'min': 0.60, 'target': 0.75}
|
| 177 |
-
}
|
| 178 |
|
| 179 |
# Crear dos columnas para las métricas y el gráfico
|
| 180 |
metrics_col, graph_col = st.columns([1, 1.5])
|
| 181 |
|
| 182 |
-
# Columna de métricas
|
| 183 |
with metrics_col:
|
| 184 |
-
# Radio buttons para tipo de texto
|
| 185 |
-
st.markdown("### Tipo de texto")
|
| 186 |
-
selected_type = st.radio(
|
| 187 |
-
"",
|
| 188 |
-
options=list(TEXT_TYPES.keys()),
|
| 189 |
-
format_func=lambda x: TEXT_TYPES[x]['name'],
|
| 190 |
-
key="text_type_radio",
|
| 191 |
-
help="Selecciona el tipo de texto para ajustar los criterios de evaluación"
|
| 192 |
-
)
|
| 193 |
-
|
| 194 |
-
# Actualizar umbrales si cambia el tipo
|
| 195 |
-
if selected_type != text_type:
|
| 196 |
-
thresholds = TEXT_TYPES[selected_type]['thresholds']
|
| 197 |
-
|
| 198 |
-
st.markdown("<div style='margin-bottom: 1.5rem;'></div>", unsafe_allow_html=True)
|
| 199 |
-
|
| 200 |
-
# Configuración de métricas
|
| 201 |
metrics_config = [
|
| 202 |
{
|
| 203 |
'label': "Vocabulario",
|
|
@@ -260,7 +235,6 @@ def display_results(metrics, text_type=None):
|
|
| 260 |
st.error("Error al mostrar los resultados")
|
| 261 |
|
| 262 |
|
| 263 |
-
|
| 264 |
######################################
|
| 265 |
def display_radar_chart(metrics_config, thresholds):
|
| 266 |
"""
|
|
|
|
| 159 |
|
| 160 |
def display_results(metrics, text_type=None):
|
| 161 |
"""
|
| 162 |
+
Muestra los resultados del análisis: métricas verticalmente y gráfico radar.
|
|
|
|
|
|
|
|
|
|
| 163 |
"""
|
| 164 |
try:
|
| 165 |
# Usar valor por defecto si no se especifica tipo
|
| 166 |
text_type = text_type or 'student_essay'
|
| 167 |
|
| 168 |
+
# Obtener umbrales según el tipo de texto
|
| 169 |
+
thresholds = TEXT_TYPES[text_type]['thresholds']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
|
| 171 |
# Crear dos columnas para las métricas y el gráfico
|
| 172 |
metrics_col, graph_col = st.columns([1, 1.5])
|
| 173 |
|
| 174 |
+
# Columna de métricas
|
| 175 |
with metrics_col:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
metrics_config = [
|
| 177 |
{
|
| 178 |
'label': "Vocabulario",
|
|
|
|
| 235 |
st.error("Error al mostrar los resultados")
|
| 236 |
|
| 237 |
|
|
|
|
| 238 |
######################################
|
| 239 |
def display_radar_chart(metrics_config, thresholds):
|
| 240 |
"""
|