Spaces:
Sleeping
Sleeping
Update modules/discourse/discourse_interface.py
Browse files
modules/discourse/discourse_interface.py
CHANGED
|
@@ -152,6 +152,7 @@ def display_discourse_results(result, lang_code, discourse_t):
|
|
| 152 |
border-radius: 8px;
|
| 153 |
overflow-x: auto;
|
| 154 |
margin-bottom: 15px;
|
|
|
|
| 155 |
}
|
| 156 |
.concept-item {
|
| 157 |
background-color: white;
|
|
@@ -162,6 +163,7 @@ def display_discourse_results(result, lang_code, discourse_t):
|
|
| 162 |
gap: 4px;
|
| 163 |
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
| 164 |
flex-shrink: 0;
|
|
|
|
| 165 |
}
|
| 166 |
.concept-name {
|
| 167 |
font-weight: 500;
|
|
@@ -189,23 +191,23 @@ def display_discourse_results(result, lang_code, discourse_t):
|
|
| 189 |
with st.expander(discourse_t.get('doc1_title', 'Documento 1'), expanded=True):
|
| 190 |
st.subheader(discourse_t.get('key_concepts', 'Conceptos Clave'))
|
| 191 |
if 'key_concepts1' in result:
|
| 192 |
-
# Crear HTML para conceptos horizontales
|
| 193 |
-
concepts_html =
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
<span class="concept-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
st.markdown(concepts_html, unsafe_allow_html=True)
|
| 203 |
|
|
|
|
| 204 |
if 'graph1' in result:
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
| 209 |
else:
|
| 210 |
st.warning(discourse_t.get('graph_not_available', 'Gr谩fico no disponible'))
|
| 211 |
else:
|
|
@@ -216,23 +218,23 @@ def display_discourse_results(result, lang_code, discourse_t):
|
|
| 216 |
with st.expander(discourse_t.get('doc2_title', 'Documento 2'), expanded=True):
|
| 217 |
st.subheader(discourse_t.get('key_concepts', 'Conceptos Clave'))
|
| 218 |
if 'key_concepts2' in result:
|
| 219 |
-
# Crear HTML para conceptos horizontales
|
| 220 |
-
concepts_html =
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
<span class="concept-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
st.markdown(concepts_html, unsafe_allow_html=True)
|
| 230 |
|
|
|
|
| 231 |
if 'graph2' in result:
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
| 236 |
else:
|
| 237 |
st.warning(discourse_t.get('graph_not_available', 'Gr谩fico no disponible'))
|
| 238 |
else:
|
|
@@ -240,4 +242,4 @@ def display_discourse_results(result, lang_code, discourse_t):
|
|
| 240 |
|
| 241 |
# Nota informativa sobre la comparaci贸n
|
| 242 |
st.info(discourse_t.get('comparison_note',
|
| 243 |
-
'La funcionalidad de comparaci贸n detallada estar谩 disponible en una pr贸xima actualizaci贸n.'))
|
|
|
|
| 152 |
border-radius: 8px;
|
| 153 |
overflow-x: auto;
|
| 154 |
margin-bottom: 15px;
|
| 155 |
+
white-space: nowrap;
|
| 156 |
}
|
| 157 |
.concept-item {
|
| 158 |
background-color: white;
|
|
|
|
| 163 |
gap: 4px;
|
| 164 |
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
| 165 |
flex-shrink: 0;
|
| 166 |
+
min-width: fit-content;
|
| 167 |
}
|
| 168 |
.concept-name {
|
| 169 |
font-weight: 500;
|
|
|
|
| 191 |
with st.expander(discourse_t.get('doc1_title', 'Documento 1'), expanded=True):
|
| 192 |
st.subheader(discourse_t.get('key_concepts', 'Conceptos Clave'))
|
| 193 |
if 'key_concepts1' in result:
|
| 194 |
+
# Crear HTML para conceptos horizontales de manera m谩s compacta
|
| 195 |
+
concepts_html = f"""
|
| 196 |
+
<div class="concepts-container">
|
| 197 |
+
{''.join([
|
| 198 |
+
f'<div class="concept-item"><span class="concept-name">{concept}</span>'
|
| 199 |
+
f'<span class="concept-freq">({freq:.2f})</span></div>'
|
| 200 |
+
for concept, freq in result['key_concepts1']
|
| 201 |
+
])}
|
| 202 |
+
</div>
|
| 203 |
+
"""
|
| 204 |
st.markdown(concepts_html, unsafe_allow_html=True)
|
| 205 |
|
| 206 |
+
# Mostrar grafo
|
| 207 |
if 'graph1' in result:
|
| 208 |
+
st.markdown('<div class="graph-container">', unsafe_allow_html=True)
|
| 209 |
+
st.pyplot(result['graph1'])
|
| 210 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
|
|
|
| 211 |
else:
|
| 212 |
st.warning(discourse_t.get('graph_not_available', 'Gr谩fico no disponible'))
|
| 213 |
else:
|
|
|
|
| 218 |
with st.expander(discourse_t.get('doc2_title', 'Documento 2'), expanded=True):
|
| 219 |
st.subheader(discourse_t.get('key_concepts', 'Conceptos Clave'))
|
| 220 |
if 'key_concepts2' in result:
|
| 221 |
+
# Crear HTML para conceptos horizontales de manera m谩s compacta
|
| 222 |
+
concepts_html = f"""
|
| 223 |
+
<div class="concepts-container">
|
| 224 |
+
{''.join([
|
| 225 |
+
f'<div class="concept-item"><span class="concept-name">{concept}</span>'
|
| 226 |
+
f'<span class="concept-freq">({freq:.2f})</span></div>'
|
| 227 |
+
for concept, freq in result['key_concepts2']
|
| 228 |
+
])}
|
| 229 |
+
</div>
|
| 230 |
+
"""
|
| 231 |
st.markdown(concepts_html, unsafe_allow_html=True)
|
| 232 |
|
| 233 |
+
# Mostrar grafo
|
| 234 |
if 'graph2' in result:
|
| 235 |
+
st.markdown('<div class="graph-container">', unsafe_allow_html=True)
|
| 236 |
+
st.pyplot(result['graph2'])
|
| 237 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
|
|
|
| 238 |
else:
|
| 239 |
st.warning(discourse_t.get('graph_not_available', 'Gr谩fico no disponible'))
|
| 240 |
else:
|
|
|
|
| 242 |
|
| 243 |
# Nota informativa sobre la comparaci贸n
|
| 244 |
st.info(discourse_t.get('comparison_note',
|
| 245 |
+
'La funcionalidad de comparaci贸n detallada estar谩 disponible en una pr贸xima actualizaci贸n.'))
|