Update modules/ui/ui.py
Browse files- modules/ui/ui.py +13 -13
modules/ui/ui.py
CHANGED
|
@@ -984,47 +984,47 @@ def display_discourse_analysis_interface(nlp_models, lang_code):
|
|
| 984 |
|
| 985 |
def display_discourse_results(result, lang_code, t):
|
| 986 |
if result is None:
|
| 987 |
-
st.warning(t
|
| 988 |
return
|
| 989 |
|
| 990 |
col1, col2 = st.columns(2)
|
| 991 |
|
| 992 |
with col1:
|
| 993 |
-
with st.expander(t
|
| 994 |
if 'graph1' in result:
|
| 995 |
st.pyplot(result['graph1'])
|
| 996 |
else:
|
| 997 |
-
st.warning(t
|
| 998 |
-
st.subheader(t
|
| 999 |
if 'key_concepts1' in result:
|
| 1000 |
concept_text1 = " | ".join([f"{concept} ({frequency:.2f})" for concept, frequency in result['key_concepts1']])
|
| 1001 |
st.write(concept_text1)
|
| 1002 |
else:
|
| 1003 |
-
st.warning(t
|
| 1004 |
|
| 1005 |
with col2:
|
| 1006 |
-
with st.expander(t
|
| 1007 |
if 'graph2' in result:
|
| 1008 |
st.pyplot(result['graph2'])
|
| 1009 |
else:
|
| 1010 |
-
st.warning(t
|
| 1011 |
-
st.subheader(t
|
| 1012 |
if 'key_concepts2' in result:
|
| 1013 |
concept_text2 = " | ".join([f"{concept} ({frequency:.2f})" for concept, frequency in result['key_concepts2']])
|
| 1014 |
st.write(concept_text2)
|
| 1015 |
else:
|
| 1016 |
-
st.warning(t
|
| 1017 |
|
| 1018 |
# Aquí puedes añadir más visualizaciones o comparaciones entre los dos documentos
|
| 1019 |
-
st.subheader(t
|
| 1020 |
if 'key_concepts1' in result and 'key_concepts2' in result:
|
| 1021 |
df = pd.DataFrame({
|
| 1022 |
-
t
|
| 1023 |
-
t
|
| 1024 |
}).fillna(0)
|
| 1025 |
st.dataframe(df)
|
| 1026 |
else:
|
| 1027 |
-
st.warning(t
|
| 1028 |
|
| 1029 |
##################################################################################################
|
| 1030 |
#def display_saved_discourse_analysis(analysis_data):
|
|
|
|
| 984 |
|
| 985 |
def display_discourse_results(result, lang_code, t):
|
| 986 |
if result is None:
|
| 987 |
+
st.warning(t.get('no_results', "No hay resultados disponibles."))
|
| 988 |
return
|
| 989 |
|
| 990 |
col1, col2 = st.columns(2)
|
| 991 |
|
| 992 |
with col1:
|
| 993 |
+
with st.expander(t.get('file_uploader1', "Documento 1"), expanded=True):
|
| 994 |
if 'graph1' in result:
|
| 995 |
st.pyplot(result['graph1'])
|
| 996 |
else:
|
| 997 |
+
st.warning(t.get('graph_not_available', "El gráfico no está disponible."))
|
| 998 |
+
st.subheader(t.get('key_concepts', "Conceptos Clave"))
|
| 999 |
if 'key_concepts1' in result:
|
| 1000 |
concept_text1 = " | ".join([f"{concept} ({frequency:.2f})" for concept, frequency in result['key_concepts1']])
|
| 1001 |
st.write(concept_text1)
|
| 1002 |
else:
|
| 1003 |
+
st.warning(t.get('concepts_not_available', "Los conceptos clave no están disponibles."))
|
| 1004 |
|
| 1005 |
with col2:
|
| 1006 |
+
with st.expander(t.get('file_uploader2', "Documento 2"), expanded=True):
|
| 1007 |
if 'graph2' in result:
|
| 1008 |
st.pyplot(result['graph2'])
|
| 1009 |
else:
|
| 1010 |
+
st.warning(t.get('graph_not_available', "El gráfico no está disponible."))
|
| 1011 |
+
st.subheader(t.get('key_concepts', "Conceptos Clave"))
|
| 1012 |
if 'key_concepts2' in result:
|
| 1013 |
concept_text2 = " | ".join([f"{concept} ({frequency:.2f})" for concept, frequency in result['key_concepts2']])
|
| 1014 |
st.write(concept_text2)
|
| 1015 |
else:
|
| 1016 |
+
st.warning(t.get('concepts_not_available', "Los conceptos clave no están disponibles."))
|
| 1017 |
|
| 1018 |
# Aquí puedes añadir más visualizaciones o comparaciones entre los dos documentos
|
| 1019 |
+
st.subheader(t.get('comparison', "Comparación"))
|
| 1020 |
if 'key_concepts1' in result and 'key_concepts2' in result:
|
| 1021 |
df = pd.DataFrame({
|
| 1022 |
+
t.get('file_uploader1', "Documento 1"): dict(result['key_concepts1']),
|
| 1023 |
+
t.get('file_uploader2', "Documento 2"): dict(result['key_concepts2'])
|
| 1024 |
}).fillna(0)
|
| 1025 |
st.dataframe(df)
|
| 1026 |
else:
|
| 1027 |
+
st.warning(t.get('comparison_not_available', "La comparación no está disponible."))
|
| 1028 |
|
| 1029 |
##################################################################################################
|
| 1030 |
#def display_saved_discourse_analysis(analysis_data):
|