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