Spaces:
Sleeping
Sleeping
Update modules/studentact/student_activities_v2.py
Browse files
modules/studentact/student_activities_v2.py
CHANGED
|
@@ -108,9 +108,12 @@ def display_semantic_activities(username: str, t: dict):
|
|
| 108 |
logger.info(f"Procesando {len(analyses)} análisis semánticos")
|
| 109 |
for analysis in analyses:
|
| 110 |
try:
|
|
|
|
|
|
|
|
|
|
| 111 |
# Verificar campos mínimos necesarios
|
| 112 |
-
if not
|
| 113 |
-
logger.warning(
|
| 114 |
continue
|
| 115 |
|
| 116 |
# Formatear fecha
|
|
@@ -118,16 +121,28 @@ def display_semantic_activities(username: str, t: dict):
|
|
| 118 |
formatted_date = timestamp.strftime("%d/%m/%Y %H:%M:%S")
|
| 119 |
|
| 120 |
with st.expander(f"{t.get('analysis_date', 'Fecha')}: {formatted_date}", expanded=False):
|
| 121 |
-
|
| 122 |
-
|
| 123 |
try:
|
|
|
|
|
|
|
| 124 |
image_bytes = base64.b64decode(analysis['concept_graph'])
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
logger.debug("Gráfico mostrado exitosamente")
|
| 127 |
except Exception as img_error:
|
| 128 |
-
logger.error(f"Error
|
| 129 |
st.error(t.get('error_loading_graph', 'Error al cargar el gráfico'))
|
| 130 |
else:
|
|
|
|
| 131 |
st.info(t.get('no_graph', 'No hay visualización disponible'))
|
| 132 |
|
| 133 |
except Exception as e:
|
|
@@ -138,7 +153,6 @@ def display_semantic_activities(username: str, t: dict):
|
|
| 138 |
logger.error(f"Error mostrando análisis semántico: {str(e)}")
|
| 139 |
st.error(t.get('error_semantic', 'Error al mostrar análisis semántico'))
|
| 140 |
|
| 141 |
-
|
| 142 |
###################################################################################################
|
| 143 |
def display_discourse_activities(username: str, t: dict):
|
| 144 |
"""Muestra actividades de análisis del discurso"""
|
|
|
|
| 108 |
logger.info(f"Procesando {len(analyses)} análisis semánticos")
|
| 109 |
for analysis in analyses:
|
| 110 |
try:
|
| 111 |
+
# Debug: verificar estructura del análisis
|
| 112 |
+
logger.debug(f"Claves disponibles en el análisis: {analysis.keys()}")
|
| 113 |
+
|
| 114 |
# Verificar campos mínimos necesarios
|
| 115 |
+
if 'timestamp' not in analysis:
|
| 116 |
+
logger.warning("Análisis sin timestamp")
|
| 117 |
continue
|
| 118 |
|
| 119 |
# Formatear fecha
|
|
|
|
| 121 |
formatted_date = timestamp.strftime("%d/%m/%Y %H:%M:%S")
|
| 122 |
|
| 123 |
with st.expander(f"{t.get('analysis_date', 'Fecha')}: {formatted_date}", expanded=False):
|
| 124 |
+
# Mostrar gráfico de conceptos
|
| 125 |
+
if 'concept_graph' in analysis and analysis['concept_graph']:
|
| 126 |
try:
|
| 127 |
+
logger.debug("Intentando decodificar gráfico de conceptos")
|
| 128 |
+
# El gráfico ya está en base64, solo necesitamos decodificarlo
|
| 129 |
image_bytes = base64.b64decode(analysis['concept_graph'])
|
| 130 |
+
|
| 131 |
+
# Debug: verificar contenido de bytes
|
| 132 |
+
logger.debug(f"Longitud de bytes de imagen: {len(image_bytes)}")
|
| 133 |
+
|
| 134 |
+
# Mostrar imagen
|
| 135 |
+
st.image(
|
| 136 |
+
image_bytes,
|
| 137 |
+
caption=t.get('concept_network', 'Red de Conceptos'),
|
| 138 |
+
use_column_width=True
|
| 139 |
+
)
|
| 140 |
logger.debug("Gráfico mostrado exitosamente")
|
| 141 |
except Exception as img_error:
|
| 142 |
+
logger.error(f"Error mostrando gráfico: {str(img_error)}")
|
| 143 |
st.error(t.get('error_loading_graph', 'Error al cargar el gráfico'))
|
| 144 |
else:
|
| 145 |
+
logger.warning("No se encontró gráfico de conceptos o está vacío")
|
| 146 |
st.info(t.get('no_graph', 'No hay visualización disponible'))
|
| 147 |
|
| 148 |
except Exception as e:
|
|
|
|
| 153 |
logger.error(f"Error mostrando análisis semántico: {str(e)}")
|
| 154 |
st.error(t.get('error_semantic', 'Error al mostrar análisis semántico'))
|
| 155 |
|
|
|
|
| 156 |
###################################################################################################
|
| 157 |
def display_discourse_activities(username: str, t: dict):
|
| 158 |
"""Muestra actividades de análisis del discurso"""
|