Update modules/ui.py
Browse files- modules/ui.py +16 -19
modules/ui.py
CHANGED
|
@@ -36,16 +36,12 @@ def register_page():
|
|
| 36 |
st.title("Registrarse")
|
| 37 |
new_username = st.text_input("Nuevo Usuario")
|
| 38 |
new_password = st.text_input("Nueva Contraseña", type='password')
|
| 39 |
-
role = st.selectbox("Rol", ["Estudiante", "Profesor"])
|
| 40 |
|
| 41 |
additional_info = {}
|
| 42 |
-
|
| 43 |
-
additional_info['carrera'] = st.text_input("Carrera")
|
| 44 |
-
elif role == "Profesor":
|
| 45 |
-
additional_info['departamento'] = st.text_input("Departamento")
|
| 46 |
|
| 47 |
if st.button("Registrarse"):
|
| 48 |
-
if register_user(new_username, new_password,
|
| 49 |
st.success("Registro exitoso. Por favor, inicia sesión.")
|
| 50 |
else:
|
| 51 |
st.error("El usuario ya existe o ocurrió un error durante el registro")
|
|
@@ -94,20 +90,21 @@ def display_student_progress(username):
|
|
| 94 |
st.success(f"Datos obtenidos exitosamente para {username}")
|
| 95 |
|
| 96 |
# Mostrar estadísticas generales
|
| 97 |
-
st.header("
|
| 98 |
st.metric("Total de entradas", student_data['entries_count'])
|
| 99 |
|
| 100 |
-
#
|
| 101 |
if student_data['word_count']:
|
| 102 |
st.subheader("Conteo Total de Palabras por Categoría Gramatical")
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
ax.
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
plt.
|
|
|
|
| 111 |
st.pyplot(fig)
|
| 112 |
else:
|
| 113 |
st.info("No hay datos de conteo de palabras disponibles.")
|
|
@@ -138,9 +135,9 @@ def display_student_progress(username):
|
|
| 138 |
#for i, entry in enumerate(student_data['entries'][:5]): # Mostrar las 5 entradas más recientes
|
| 139 |
# with st.expander(f"Entrada {i+1} - {entry['timestamp']}"):
|
| 140 |
# st.write(entry['text'])
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
|
| 145 |
##########################################################################
|
| 146 |
def display_text_analysis_interface(nlp_models, lang_code):
|
|
|
|
| 36 |
st.title("Registrarse")
|
| 37 |
new_username = st.text_input("Nuevo Usuario")
|
| 38 |
new_password = st.text_input("Nueva Contraseña", type='password')
|
|
|
|
| 39 |
|
| 40 |
additional_info = {}
|
| 41 |
+
additional_info['carrera'] = st.text_input("Carrera")
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
if st.button("Registrarse"):
|
| 44 |
+
if register_user(new_username, new_password, "Estudiante", additional_info):
|
| 45 |
st.success("Registro exitoso. Por favor, inicia sesión.")
|
| 46 |
else:
|
| 47 |
st.error("El usuario ya existe o ocurrió un error durante el registro")
|
|
|
|
| 90 |
st.success(f"Datos obtenidos exitosamente para {username}")
|
| 91 |
|
| 92 |
# Mostrar estadísticas generales
|
| 93 |
+
st.header("Estadísticas Generales")
|
| 94 |
st.metric("Total de entradas", student_data['entries_count'])
|
| 95 |
|
| 96 |
+
# Treemap para el conteo de palabras por categoría
|
| 97 |
if student_data['word_count']:
|
| 98 |
st.subheader("Conteo Total de Palabras por Categoría Gramatical")
|
| 99 |
+
|
| 100 |
+
df = pd.DataFrame(list(student_data['word_count'].items()), columns=['category', 'count'])
|
| 101 |
+
df['label'] = df.apply(lambda x: f"{x['category']}\n({x['count']})", axis=1)
|
| 102 |
+
|
| 103 |
+
fig, ax = plt.subplots(figsize=(12, 8), dpi=80)
|
| 104 |
+
colors = [POS_COLORS.get(cat, '#CCCCCC') for cat in df['category']]
|
| 105 |
+
squarify.plot(sizes=df['count'], label=df['label'], color=colors, alpha=0.8, ax=ax)
|
| 106 |
+
plt.title('Treemap de Categorías Gramaticales')
|
| 107 |
+
plt.axis('off')
|
| 108 |
st.pyplot(fig)
|
| 109 |
else:
|
| 110 |
st.info("No hay datos de conteo de palabras disponibles.")
|
|
|
|
| 135 |
#for i, entry in enumerate(student_data['entries'][:5]): # Mostrar las 5 entradas más recientes
|
| 136 |
# with st.expander(f"Entrada {i+1} - {entry['timestamp']}"):
|
| 137 |
# st.write(entry['text'])
|
| 138 |
+
else:
|
| 139 |
+
st.warning("No se encontraron entradas para este estudiante.")
|
| 140 |
+
st.info("Intenta realizar algunos análisis de texto primero.")
|
| 141 |
|
| 142 |
##########################################################################
|
| 143 |
def display_text_analysis_interface(nlp_models, lang_code):
|