Spaces:
Sleeping
Sleeping
Update modules/semantic/semantic_interface.py
Browse files
modules/semantic/semantic_interface.py
CHANGED
@@ -208,11 +208,11 @@ def display_semantic_results(semantic_result, lang_code, semantic_t):
|
|
208 |
#Colocar aquí el bloque de código
|
209 |
if 'concept_graph' in analysis and analysis['concept_graph'] is not None:
|
210 |
try:
|
211 |
-
#
|
212 |
st.markdown(
|
213 |
"""
|
214 |
<style>
|
215 |
-
.
|
216 |
background-color: white;
|
217 |
border-radius: 10px;
|
218 |
padding: 20px;
|
@@ -228,30 +228,18 @@ def display_semantic_results(semantic_result, lang_code, semantic_t):
|
|
228 |
""",
|
229 |
unsafe_allow_html=True
|
230 |
)
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
f'<img src="data:image/png;base64,{graph_base64}" alt="Concept Graph" style="width:100%;"/>',
|
241 |
-
unsafe_allow_html=True
|
242 |
-
)
|
243 |
-
|
244 |
-
# Leyenda del grafo
|
245 |
-
#st.caption(semantic_t.get(
|
246 |
-
# 'graph_description',
|
247 |
-
# 'Visualización de relaciones entre conceptos clave identificados en el texto.'
|
248 |
-
#))
|
249 |
-
|
250 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
251 |
-
|
252 |
# Expandible con la interpretación
|
253 |
with st.expander("📊 " + semantic_t.get('semantic_graph_interpretation', "Interpretación del gráfico semántico")):
|
254 |
-
|
255 |
- 🔀 {semantic_t.get('semantic_arrow_meaning', 'Las flechas indican la dirección de la relación entre conceptos')}
|
256 |
- 🎨 {semantic_t.get('semantic_color_meaning', 'Los colores más intensos indican conceptos más centrales en el texto')}
|
257 |
- ⭕ {semantic_t.get('semantic_size_meaning', 'El tamaño de los nodos representa la frecuencia del concepto')}
|
@@ -272,7 +260,5 @@ def display_semantic_results(semantic_result, lang_code, semantic_t):
|
|
272 |
except Exception as e:
|
273 |
logger.error(f"Error displaying graph: {str(e)}")
|
274 |
st.error(semantic_t.get('graph_error', 'Error displaying the graph'))
|
275 |
-
else:
|
276 |
-
st.info(semantic_t.get('no_graph', 'No concept graph available'))
|
277 |
|
278 |
########################################################################################
|
|
|
208 |
#Colocar aquí el bloque de código
|
209 |
if 'concept_graph' in analysis and analysis['concept_graph'] is not None:
|
210 |
try:
|
211 |
+
# Aplicar estilos directamente al contenedor de Streamlit
|
212 |
st.markdown(
|
213 |
"""
|
214 |
<style>
|
215 |
+
.stContainer {
|
216 |
background-color: white;
|
217 |
border-radius: 10px;
|
218 |
padding: 20px;
|
|
|
228 |
""",
|
229 |
unsafe_allow_html=True
|
230 |
)
|
231 |
+
|
232 |
+
# Mostrar el gráfico directamente sin el div adicional
|
233 |
+
graph_bytes = analysis['concept_graph']
|
234 |
+
graph_base64 = base64.b64encode(graph_bytes).decode()
|
235 |
+
st.markdown(
|
236 |
+
f'<img src="data:image/png;base64,{graph_base64}" alt="Concept Graph" style="width:100%;"/>',
|
237 |
+
unsafe_allow_html=True
|
238 |
+
)
|
239 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
# Expandible con la interpretación
|
241 |
with st.expander("📊 " + semantic_t.get('semantic_graph_interpretation', "Interpretación del gráfico semántico")):
|
242 |
+
st.markdown(f"""
|
243 |
- 🔀 {semantic_t.get('semantic_arrow_meaning', 'Las flechas indican la dirección de la relación entre conceptos')}
|
244 |
- 🎨 {semantic_t.get('semantic_color_meaning', 'Los colores más intensos indican conceptos más centrales en el texto')}
|
245 |
- ⭕ {semantic_t.get('semantic_size_meaning', 'El tamaño de los nodos representa la frecuencia del concepto')}
|
|
|
260 |
except Exception as e:
|
261 |
logger.error(f"Error displaying graph: {str(e)}")
|
262 |
st.error(semantic_t.get('graph_error', 'Error displaying the graph'))
|
|
|
|
|
263 |
|
264 |
########################################################################################
|