Spaces:
Running
Running
Update modules/studentact/current_situation_interface.py
Browse files
modules/studentact/current_situation_interface.py
CHANGED
|
@@ -48,15 +48,34 @@ def display_current_situation_interface(lang_code, nlp_models, t):
|
|
| 48 |
if 'current_metrics' not in st.session_state:
|
| 49 |
st.session_state.current_metrics = None
|
| 50 |
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
# Container principal con dos columnas
|
| 54 |
with st.container():
|
| 55 |
input_col, results_col = st.columns([1,2])
|
| 56 |
|
| 57 |
with input_col:
|
| 58 |
-
#st.markdown("### Ingresa tu texto")
|
| 59 |
-
|
| 60 |
# Función para manejar cambios en el texto
|
| 61 |
def on_text_change():
|
| 62 |
st.session_state.text_input = st.session_state.text_area
|
|
@@ -106,7 +125,50 @@ def display_current_situation_interface(lang_code, nlp_models, t):
|
|
| 106 |
# Mostrar resultados en la columna derecha
|
| 107 |
with results_col:
|
| 108 |
if st.session_state.show_results and st.session_state.current_metrics is not None:
|
| 109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
except Exception as e:
|
| 112 |
logger.error(f"Error en interfaz: {str(e)}")
|
|
|
|
| 48 |
if 'current_metrics' not in st.session_state:
|
| 49 |
st.session_state.current_metrics = None
|
| 50 |
|
| 51 |
+
# Estilos CSS para mejorar la presentación
|
| 52 |
+
st.markdown("""
|
| 53 |
+
<style>
|
| 54 |
+
.main-title {
|
| 55 |
+
margin-bottom: 2rem;
|
| 56 |
+
}
|
| 57 |
+
.stTextArea textarea {
|
| 58 |
+
border-radius: 0.5rem;
|
| 59 |
+
}
|
| 60 |
+
div[data-testid="column"] {
|
| 61 |
+
background-color: transparent;
|
| 62 |
+
}
|
| 63 |
+
.metric-container {
|
| 64 |
+
background-color: #f8f9fa;
|
| 65 |
+
padding: 1rem;
|
| 66 |
+
border-radius: 0.5rem;
|
| 67 |
+
margin-bottom: 1rem;
|
| 68 |
+
}
|
| 69 |
+
</style>
|
| 70 |
+
""", unsafe_allow_html=True)
|
| 71 |
+
|
| 72 |
+
st.markdown('<h2 class="main-title">Análisis Inicial de Escritura</h2>', unsafe_allow_html=True)
|
| 73 |
|
| 74 |
# Container principal con dos columnas
|
| 75 |
with st.container():
|
| 76 |
input_col, results_col = st.columns([1,2])
|
| 77 |
|
| 78 |
with input_col:
|
|
|
|
|
|
|
| 79 |
# Función para manejar cambios en el texto
|
| 80 |
def on_text_change():
|
| 81 |
st.session_state.text_input = st.session_state.text_area
|
|
|
|
| 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 |
+
# Container para los resultados
|
| 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)}")
|