Update modules/ui.py
Browse files- modules/ui.py +24 -15
modules/ui.py
CHANGED
|
@@ -4,6 +4,7 @@ import streamlit as st
|
|
| 4 |
from spacy import displacy
|
| 5 |
import re
|
| 6 |
from .morpho_analysis import POS_TRANSLATIONS # Aseg煤rate de que esta importaci贸n est茅 presente
|
|
|
|
| 7 |
import matplotlib.pyplot as plt
|
| 8 |
import matplotlib
|
| 9 |
matplotlib.use('Agg')
|
|
@@ -77,6 +78,7 @@ def display_chat_interface():
|
|
| 77 |
st.experimental_rerun()
|
| 78 |
|
| 79 |
##########################################################################
|
|
|
|
| 80 |
def display_student_progress(username):
|
| 81 |
st.title(f"Progreso de {username}")
|
| 82 |
|
|
@@ -111,8 +113,8 @@ def display_student_progress(username):
|
|
| 111 |
# Mostrar evoluci贸n del conteo de palabras
|
| 112 |
st.subheader("Evoluci贸n del Conteo de Palabras")
|
| 113 |
evolution_data = {}
|
| 114 |
-
for
|
| 115 |
-
for category, count in entry
|
| 116 |
if category not in evolution_data:
|
| 117 |
evolution_data[category] = []
|
| 118 |
evolution_data[category].append(count)
|
|
@@ -129,24 +131,31 @@ def display_student_progress(username):
|
|
| 129 |
else:
|
| 130 |
st.info("No hay suficientes datos para mostrar la evoluci贸n del conteo de palabras.")
|
| 131 |
|
| 132 |
-
#
|
| 133 |
-
st.header("
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
st.write(entry['arc_diagrams'][0], unsafe_allow_html=True)
|
| 140 |
-
|
| 141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
st.image(entry['network_diagram'])
|
|
|
|
|
|
|
|
|
|
| 143 |
else:
|
| 144 |
st.warning("No se encontraron datos para este estudiante.")
|
| 145 |
st.info("Intenta realizar algunos an谩lisis de texto primero.")
|
| 146 |
-
|
| 147 |
-
# Agregar informaci贸n de depuraci贸n
|
| 148 |
-
st.subheader("Informaci贸n de Depuraci贸n")
|
| 149 |
-
st.json(student_data)
|
| 150 |
|
| 151 |
##########################################################################
|
| 152 |
def display_text_analysis_interface(nlp_models, lang_code):
|
|
|
|
| 4 |
from spacy import displacy
|
| 5 |
import re
|
| 6 |
from .morpho_analysis import POS_TRANSLATIONS # Aseg煤rate de que esta importaci贸n est茅 presente
|
| 7 |
+
from datetime import datetime
|
| 8 |
import matplotlib.pyplot as plt
|
| 9 |
import matplotlib
|
| 10 |
matplotlib.use('Agg')
|
|
|
|
| 78 |
st.experimental_rerun()
|
| 79 |
|
| 80 |
##########################################################################
|
| 81 |
+
|
| 82 |
def display_student_progress(username):
|
| 83 |
st.title(f"Progreso de {username}")
|
| 84 |
|
|
|
|
| 113 |
# Mostrar evoluci贸n del conteo de palabras
|
| 114 |
st.subheader("Evoluci贸n del Conteo de Palabras")
|
| 115 |
evolution_data = {}
|
| 116 |
+
for entry in student_data['entries']:
|
| 117 |
+
for category, count in entry['word_count'].items():
|
| 118 |
if category not in evolution_data:
|
| 119 |
evolution_data[category] = []
|
| 120 |
evolution_data[category].append(count)
|
|
|
|
| 131 |
else:
|
| 132 |
st.info("No hay suficientes datos para mostrar la evoluci贸n del conteo de palabras.")
|
| 133 |
|
| 134 |
+
# Lista colapsable de diagramas de arco
|
| 135 |
+
st.header("Diagramas de Arco")
|
| 136 |
+
arc_diagrams = [entry for entry in student_data['entries'] if entry.get('arc_diagrams')]
|
| 137 |
+
if arc_diagrams:
|
| 138 |
+
for i, entry in enumerate(arc_diagrams):
|
| 139 |
+
timestamp = datetime.fromisoformat(entry['timestamp'])
|
| 140 |
+
with st.expander(f"Diagrama de Arco - {timestamp.strftime('%Y-%m-%d %H:%M:%S')}"):
|
| 141 |
st.write(entry['arc_diagrams'][0], unsafe_allow_html=True)
|
| 142 |
+
else:
|
| 143 |
+
st.info("No hay diagramas de arco disponibles.")
|
| 144 |
+
|
| 145 |
+
# Lista colapsable de diagramas de red
|
| 146 |
+
st.header("Diagramas de Red")
|
| 147 |
+
network_diagrams = [entry for entry in student_data['entries'] if entry.get('network_diagram')]
|
| 148 |
+
if network_diagrams:
|
| 149 |
+
for i, entry in enumerate(network_diagrams):
|
| 150 |
+
timestamp = datetime.fromisoformat(entry['timestamp'])
|
| 151 |
+
with st.expander(f"Diagrama de Red - {timestamp.strftime('%Y-%m-%d %H:%M:%S')}"):
|
| 152 |
st.image(entry['network_diagram'])
|
| 153 |
+
else:
|
| 154 |
+
st.info("No hay diagramas de red disponibles.")
|
| 155 |
+
|
| 156 |
else:
|
| 157 |
st.warning("No se encontraron datos para este estudiante.")
|
| 158 |
st.info("Intenta realizar algunos an谩lisis de texto primero.")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
|
| 160 |
##########################################################################
|
| 161 |
def display_text_analysis_interface(nlp_models, lang_code):
|