Update modules/ui/ui.py
Browse files- modules/ui/ui.py +13 -26
modules/ui/ui.py
CHANGED
@@ -391,35 +391,23 @@ def display_student_progress(username, lang_code='es'):
|
|
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('
|
395 |
-
st.write(f"Archivo comparado: {entry.get('
|
396 |
|
397 |
try:
|
398 |
-
|
399 |
-
if 'graph1' in entry and 'graph2' in entry:
|
400 |
-
img1 = Image.open(BytesIO(base64.b64decode(entry['graph1'])))
|
401 |
-
img2 = Image.open(BytesIO(base64.b64decode(entry['graph2'])))
|
402 |
-
|
403 |
-
# Crear una nueva imagen combinada
|
404 |
-
total_width = img1.width + img2.width
|
405 |
-
max_height = max(img1.height, img2.height)
|
406 |
-
combined_img = Image.new('RGB', (total_width, max_height))
|
407 |
-
|
408 |
-
# Pegar las dos im谩genes lado a lado
|
409 |
-
combined_img.paste(img1, (0, 0))
|
410 |
-
combined_img.paste(img2, (img1.width, 0))
|
411 |
-
|
412 |
-
# Convertir la imagen combinada a bytes
|
413 |
-
buffered = BytesIO()
|
414 |
-
combined_img.save(buffered, format="PNG")
|
415 |
-
img_str = base64.b64encode(buffered.getvalue()).decode()
|
416 |
-
|
417 |
-
# Mostrar la imagen combinada
|
418 |
-
st.image(f"data:image/png;base64,{img_str}")
|
419 |
-
elif 'combined_graph' in entry:
|
420 |
-
# Si ya existe una imagen combinada, mostrarla directamente
|
421 |
img_bytes = base64.b64decode(entry['combined_graph'])
|
422 |
st.image(img_bytes)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
423 |
else:
|
424 |
st.write("No se encontraron gr谩ficos para este an谩lisis.")
|
425 |
except Exception as e:
|
@@ -431,7 +419,6 @@ def display_student_progress(username, lang_code='es'):
|
|
431 |
st.write("Graph 2:", entry['graph2'][:100] + "...")
|
432 |
if 'combined_graph' in entry:
|
433 |
st.write("Combined Graph:", entry['combined_graph'][:100] + "...")
|
434 |
-
|
435 |
|
436 |
##########################################################
|
437 |
with st.expander("Hist贸rico de Conversaciones con el ChatBot"):
|
|
|
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']:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
399 |
img_bytes = base64.b64decode(entry['combined_graph'])
|
400 |
st.image(img_bytes)
|
401 |
+
elif 'graph1' in entry and 'graph2' in entry:
|
402 |
+
col1, col2 = st.columns(2)
|
403 |
+
with col1:
|
404 |
+
if entry['graph1']:
|
405 |
+
img_bytes1 = base64.b64decode(entry['graph1'])
|
406 |
+
st.image(img_bytes1)
|
407 |
+
with col2:
|
408 |
+
if entry['graph2']:
|
409 |
+
img_bytes2 = base64.b64decode(entry['graph2'])
|
410 |
+
st.image(img_bytes2)
|
411 |
else:
|
412 |
st.write("No se encontraron gr谩ficos para este an谩lisis.")
|
413 |
except Exception as e:
|
|
|
419 |
st.write("Graph 2:", entry['graph2'][:100] + "...")
|
420 |
if 'combined_graph' in entry:
|
421 |
st.write("Combined Graph:", entry['combined_graph'][:100] + "...")
|
|
|
422 |
|
423 |
##########################################################
|
424 |
with st.expander("Hist贸rico de Conversaciones con el ChatBot"):
|