Update modules/ui.py
Browse files- modules/ui.py +48 -12
modules/ui.py
CHANGED
|
@@ -73,18 +73,54 @@ def display_chat_interface():
|
|
| 73 |
st.experimental_rerun()
|
| 74 |
|
| 75 |
##########################################################################
|
| 76 |
-
def display_student_progress(
|
| 77 |
-
st.
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
##########################################################################
|
| 90 |
def display_text_analysis_interface(nlp_models, lang_code):
|
|
|
|
| 73 |
st.experimental_rerun()
|
| 74 |
|
| 75 |
##########################################################################
|
| 76 |
+
def display_student_progress(username):
|
| 77 |
+
st.title(f"Progreso de {username}")
|
| 78 |
+
|
| 79 |
+
student_data = get_student_data(username)
|
| 80 |
+
|
| 81 |
+
if student_data and student_data['entries_count'] > 0:
|
| 82 |
+
st.success(f"Datos obtenidos exitosamente para {username}")
|
| 83 |
+
|
| 84 |
+
# Mostrar estadísticas generales
|
| 85 |
+
st.header("Estadísticas Generales")
|
| 86 |
+
st.metric("Total de entradas", student_data['entries_count'])
|
| 87 |
+
|
| 88 |
+
# Gráfico de barras para el conteo de palabras por categoría
|
| 89 |
+
if student_data['word_count']:
|
| 90 |
+
st.subheader("Conteo Total de Palabras por Categoría Gramatical")
|
| 91 |
+
fig = px.bar(x=list(student_data['word_count'].keys()),
|
| 92 |
+
y=list(student_data['word_count'].values()),
|
| 93 |
+
labels={'x': 'Categoría', 'y': 'Conteo Total'})
|
| 94 |
+
st.plotly_chart(fig)
|
| 95 |
+
|
| 96 |
+
# Mostrar evolución del conteo de palabras
|
| 97 |
+
st.subheader("Evolución del Conteo de Palabras")
|
| 98 |
+
evolution_data = []
|
| 99 |
+
for i, entry in enumerate(student_data['entries']):
|
| 100 |
+
for category, count in entry.get('word_count', {}).items():
|
| 101 |
+
evolution_data.append({
|
| 102 |
+
'Entrada': i+1,
|
| 103 |
+
'Categoría': category,
|
| 104 |
+
'Conteo': count
|
| 105 |
+
})
|
| 106 |
+
if evolution_data:
|
| 107 |
+
fig = px.line(evolution_data, x='Entrada', y='Conteo', color='Categoría')
|
| 108 |
+
st.plotly_chart(fig)
|
| 109 |
+
|
| 110 |
+
# Mostrar entradas recientes
|
| 111 |
+
st.header("Entradas Recientes")
|
| 112 |
+
for i, entry in enumerate(student_data['entries'][:5]):
|
| 113 |
+
with st.expander(f"Entrada {i+1} - {entry['timestamp']}"):
|
| 114 |
+
st.write(entry['text'])
|
| 115 |
+
if 'arc_diagrams' in student_data and len(student_data['arc_diagrams']) > i:
|
| 116 |
+
st.subheader("Diagrama de Arco")
|
| 117 |
+
st.write(student_data['arc_diagrams'][i], unsafe_allow_html=True)
|
| 118 |
+
if 'network_diagrams' in student_data and len(student_data['network_diagrams']) > i:
|
| 119 |
+
st.subheader("Diagrama de Red")
|
| 120 |
+
st.image(student_data['network_diagrams'][i])
|
| 121 |
+
else:
|
| 122 |
+
st.warning("No se encontraron datos para este estudiante.")
|
| 123 |
+
st.info("Intenta realizar algunos análisis de texto primero.")
|
| 124 |
|
| 125 |
##########################################################################
|
| 126 |
def display_text_analysis_interface(nlp_models, lang_code):
|