AIdeaText commited on
Commit
3be9d44
·
verified ·
1 Parent(s): e587251

Update modules/ui/ui.py

Browse files
Files changed (1) hide show
  1. modules/ui/ui.py +22 -15
modules/ui/ui.py CHANGED
@@ -367,32 +367,39 @@ def display_student_progress(username, lang_code='es'):
367
  ##########################################################
368
  with st.expander("Histórico de Análisis Semánticos"):
369
  semantic_entries = [entry for entry in student_data['entries'] if entry['analysis_type'] == 'semantic']
370
- st.write(f"Número total de entradas semánticas: {len(semantic_entries)}")
371
  for entry in semantic_entries:
372
  st.subheader(f"Análisis del {entry['timestamp']}")
373
- st.write(f"Archivo analizado: {entry.get('filename', 'Nombre no disponible')}")
374
- st.write(f"Claves disponibles en esta entrada: {', '.join(entry.keys())}")
375
 
376
- # Verificar si 'relations_graph' está en entry antes de intentar acceder
377
- if 'network_diagram' in entry:
 
 
 
 
 
 
378
  try:
379
- logger.info(f"Longitud de la imagen recuperada: {len(entry['network_diagram'])}")
380
- st.image(f"data:image/png;base64,{entry['network_diagram']}")
381
  except Exception as e:
382
- st.error(f"No se pudo mostrar la imagen: {str(e)}")
383
- st.write("Datos de la imagen (para depuración):")
384
- st.write(entry['network_diagram'][:100] + "...")
385
- else:
386
- logger.warning(f"No se encontró 'relations_graph' en la entrada: {entry.keys()}")
387
- st.write("No se encontró el gráfico para este análisis.")
388
 
389
  ##########################################################
390
  with st.expander("Histórico de Análisis Discursivos"):
391
  discourse_entries = [entry for entry in student_data['entries'] if entry['analysis_type'] == 'discourse']
392
  for entry in discourse_entries:
393
  st.subheader(f"Análisis del {entry['timestamp']}")
394
- st.write(f"Archivo patrón: {entry.get('text1', 'Nombre no disponible')}")
395
- st.write(f"Archivo comparado: {entry.get('text2', 'Nombre no disponible')}")
 
 
 
 
 
 
 
 
 
396
 
397
  try:
398
  if 'combined_graph' in entry and entry['combined_graph']:
 
367
  ##########################################################
368
  with st.expander("Histórico de Análisis Semánticos"):
369
  semantic_entries = [entry for entry in student_data['entries'] if entry['analysis_type'] == 'semantic']
 
370
  for entry in semantic_entries:
371
  st.subheader(f"Análisis del {entry['timestamp']}")
 
 
372
 
373
+ # Mostrar conceptos clave
374
+ if 'key_concepts' in entry:
375
+ st.write("Conceptos clave:")
376
+ for concept, frequency in entry['key_concepts']:
377
+ st.write(f"- {concept}: {frequency:.2f}")
378
+
379
+ # Mostrar gráfico
380
+ if 'graph' in entry:
381
  try:
382
+ img_bytes = base64.b64decode(entry['graph'])
383
+ st.image(img_bytes, caption="Gráfico de relaciones conceptuales")
384
  except Exception as e:
385
+ st.error(f"No se pudo mostrar el gráfico: {str(e)}")
 
 
 
 
 
386
 
387
  ##########################################################
388
  with st.expander("Histórico de Análisis Discursivos"):
389
  discourse_entries = [entry for entry in student_data['entries'] if entry['analysis_type'] == 'discourse']
390
  for entry in discourse_entries:
391
  st.subheader(f"Análisis del {entry['timestamp']}")
392
+
393
+ # Mostrar conceptos clave para ambos documentos
394
+ if 'key_concepts1' in entry:
395
+ st.write("Conceptos clave del documento 1:")
396
+ for concept, frequency in entry['key_concepts1']:
397
+ st.write(f"- {concept}: {frequency:.2f}")
398
+
399
+ if 'key_concepts2' in entry:
400
+ st.write("Conceptos clave del documento 2:")
401
+ for concept, frequency in entry['key_concepts2']:
402
+ st.write(f"- {concept}: {frequency:.2f}")
403
 
404
  try:
405
  if 'combined_graph' in entry and entry['combined_graph']: