Update modules/text_analysis/discourse_analysis.py
Browse files
modules/text_analysis/discourse_analysis.py
CHANGED
|
@@ -90,16 +90,20 @@ ENTITY_LABELS = {
|
|
| 90 |
}
|
| 91 |
|
| 92 |
#################
|
|
|
|
| 93 |
def fig_to_bytes(fig):
|
| 94 |
"""Convierte una figura de matplotlib a bytes."""
|
| 95 |
try:
|
| 96 |
buf = io.BytesIO()
|
| 97 |
-
|
|
|
|
|
|
|
| 98 |
buf.seek(0)
|
| 99 |
return buf.getvalue()
|
| 100 |
except Exception as e:
|
| 101 |
logger.error(f"Error en fig_to_bytes: {str(e)}")
|
| 102 |
return None
|
|
|
|
| 103 |
#################
|
| 104 |
def compare_semantic_analysis(text1, text2, nlp, lang):
|
| 105 |
"""
|
|
|
|
| 90 |
}
|
| 91 |
|
| 92 |
#################
|
| 93 |
+
|
| 94 |
def fig_to_bytes(fig):
|
| 95 |
"""Convierte una figura de matplotlib a bytes."""
|
| 96 |
try:
|
| 97 |
buf = io.BytesIO()
|
| 98 |
+
# Reducir DPI y usar compression
|
| 99 |
+
fig.savefig(buf, format='png', dpi=100, bbox_inches='tight',
|
| 100 |
+
compression=9) # M谩xima compresi贸n
|
| 101 |
buf.seek(0)
|
| 102 |
return buf.getvalue()
|
| 103 |
except Exception as e:
|
| 104 |
logger.error(f"Error en fig_to_bytes: {str(e)}")
|
| 105 |
return None
|
| 106 |
+
|
| 107 |
#################
|
| 108 |
def compare_semantic_analysis(text1, text2, nlp, lang):
|
| 109 |
"""
|