Update modules/studentact/student_activities_v2.py
Browse files
modules/studentact/student_activities_v2.py
CHANGED
|
@@ -560,32 +560,25 @@ def display_discourse_activities(username: str, t: dict):
|
|
| 560 |
formatted_date = timestamp.strftime("%d/%m/%Y %H:%M:%S")
|
| 561 |
|
| 562 |
with st.expander(f"{t.get('analysis_date', 'Fecha')}: {formatted_date}", expanded=False):
|
| 563 |
-
# Mostrar
|
| 564 |
-
if 'text1' in analysis and 'text2' in analysis:
|
| 565 |
-
col1, col2 = st.columns(2)
|
| 566 |
-
with col1:
|
| 567 |
-
st.markdown("**Texto 1:**")
|
| 568 |
-
st.text_area("", value=analysis['text1'], height=100, disabled=True, key=f"text1_{analysis.get('_id', 'unknown')}")
|
| 569 |
-
with col2:
|
| 570 |
-
st.markdown("**Texto 2:**")
|
| 571 |
-
st.text_area("", value=analysis['text2'], height=100, disabled=True, key=f"text2_{analysis.get('_id', 'unknown')}")
|
| 572 |
-
|
| 573 |
-
# Mostrar conceptos clave si est谩n disponibles
|
| 574 |
if 'key_concepts1' in analysis and 'key_concepts2' in analysis:
|
| 575 |
st.markdown("### Conceptos clave")
|
| 576 |
-
concept_col1, concept_col2 = st.columns(2)
|
| 577 |
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
|
|
|
|
|
|
| 583 |
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
|
| 587 |
-
|
| 588 |
-
|
|
|
|
|
|
|
| 589 |
|
| 590 |
# Mostrar gr谩ficos
|
| 591 |
st.markdown("### Visualizaci贸n comparativa")
|
|
@@ -599,7 +592,9 @@ def display_discourse_activities(username: str, t: dict):
|
|
| 599 |
try:
|
| 600 |
# Verificar que sea bytes
|
| 601 |
if isinstance(analysis['graph1'], bytes):
|
| 602 |
-
st.image(analysis['graph1'],
|
|
|
|
|
|
|
| 603 |
has_graphs = True
|
| 604 |
else:
|
| 605 |
logger.warning(f"graph1 no es bytes: {type(analysis['graph1'])}")
|
|
@@ -611,7 +606,9 @@ def display_discourse_activities(username: str, t: dict):
|
|
| 611 |
try:
|
| 612 |
# Verificar que sea bytes
|
| 613 |
if isinstance(analysis['graph2'], bytes):
|
| 614 |
-
st.image(analysis['graph2'],
|
|
|
|
|
|
|
| 615 |
has_graphs = True
|
| 616 |
else:
|
| 617 |
logger.warning(f"graph2 no es bytes: {type(analysis['graph2'])}")
|
|
@@ -629,7 +626,6 @@ def display_discourse_activities(username: str, t: dict):
|
|
| 629 |
logger.error(f"Error mostrando an谩lisis del discurso: {str(e)}")
|
| 630 |
st.error(t.get('error_discourse', 'Error al mostrar an谩lisis comparado de textos'))
|
| 631 |
|
| 632 |
-
|
| 633 |
#################################################################################
|
| 634 |
|
| 635 |
def display_discourse_comparison(analysis: dict, t: dict):
|
|
|
|
| 560 |
formatted_date = timestamp.strftime("%d/%m/%Y %H:%M:%S")
|
| 561 |
|
| 562 |
with st.expander(f"{t.get('analysis_date', 'Fecha')}: {formatted_date}", expanded=False):
|
| 563 |
+
# Mostrar conceptos clave en fila
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 564 |
if 'key_concepts1' in analysis and 'key_concepts2' in analysis:
|
| 565 |
st.markdown("### Conceptos clave")
|
|
|
|
| 566 |
|
| 567 |
+
# Documento 1
|
| 568 |
+
st.markdown("**Documento 1**")
|
| 569 |
+
if analysis['key_concepts1']:
|
| 570 |
+
# Extraer solo los conceptos sin la frecuencia
|
| 571 |
+
concepts1 = [concept for concept, _ in analysis['key_concepts1']]
|
| 572 |
+
# Mostrar en formato de fila
|
| 573 |
+
st.markdown(", ".join([f"**{concept}**" for concept in concepts1]))
|
| 574 |
|
| 575 |
+
# Documento 2
|
| 576 |
+
st.markdown("**Documento 2**")
|
| 577 |
+
if analysis['key_concepts2']:
|
| 578 |
+
# Extraer solo los conceptos sin la frecuencia
|
| 579 |
+
concepts2 = [concept for concept, _ in analysis['key_concepts2']]
|
| 580 |
+
# Mostrar en formato de fila
|
| 581 |
+
st.markdown(", ".join([f"**{concept}**" for concept in concepts2]))
|
| 582 |
|
| 583 |
# Mostrar gr谩ficos
|
| 584 |
st.markdown("### Visualizaci贸n comparativa")
|
|
|
|
| 592 |
try:
|
| 593 |
# Verificar que sea bytes
|
| 594 |
if isinstance(analysis['graph1'], bytes):
|
| 595 |
+
st.image(analysis['graph1'],
|
| 596 |
+
caption="Documento 1",
|
| 597 |
+
use_container_width=True) # Usar use_container_width en lugar de use_column_width
|
| 598 |
has_graphs = True
|
| 599 |
else:
|
| 600 |
logger.warning(f"graph1 no es bytes: {type(analysis['graph1'])}")
|
|
|
|
| 606 |
try:
|
| 607 |
# Verificar que sea bytes
|
| 608 |
if isinstance(analysis['graph2'], bytes):
|
| 609 |
+
st.image(analysis['graph2'],
|
| 610 |
+
caption="Documento 2",
|
| 611 |
+
use_container_width=True) # Usar use_container_width en lugar de use_column_width
|
| 612 |
has_graphs = True
|
| 613 |
else:
|
| 614 |
logger.warning(f"graph2 no es bytes: {type(analysis['graph2'])}")
|
|
|
|
| 626 |
logger.error(f"Error mostrando an谩lisis del discurso: {str(e)}")
|
| 627 |
st.error(t.get('error_discourse', 'Error al mostrar an谩lisis comparado de textos'))
|
| 628 |
|
|
|
|
| 629 |
#################################################################################
|
| 630 |
|
| 631 |
def display_discourse_comparison(analysis: dict, t: dict):
|