Update modules/ui.py
Browse files- modules/ui.py +23 -21
modules/ui.py
CHANGED
@@ -304,21 +304,24 @@ def display_semantic_analysis_interface(nlp_models, lang_code):
|
|
304 |
'file_uploader': "Cargar archivo de texto",
|
305 |
'analyze_button': "Analizar texto",
|
306 |
'context_analysis': "Análisis de Contexto",
|
307 |
-
'semantic_relations': "
|
|
|
308 |
},
|
309 |
'en': {
|
310 |
'title': "AIdeaText - Semantic Analysis",
|
311 |
'file_uploader': "Upload text file",
|
312 |
'analyze_button': "Analyze text",
|
313 |
'context_analysis': "Context Analysis",
|
314 |
-
'semantic_relations': "Semantic Relations
|
|
|
315 |
},
|
316 |
'fr': {
|
317 |
'title': "AIdeaText - Analyse sémantique",
|
318 |
'file_uploader': "Télécharger le fichier texte",
|
319 |
'analyze_button': "Analyser le texte",
|
320 |
'context_analysis': "Analyse de Contexte",
|
321 |
-
'semantic_relations': "
|
|
|
322 |
}
|
323 |
}
|
324 |
|
@@ -332,24 +335,23 @@ def display_semantic_analysis_interface(nlp_models, lang_code):
|
|
332 |
text_content = uploaded_file.getvalue().decode('utf-8')
|
333 |
|
334 |
if st.button(t['analyze_button']):
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
with
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
st.pyplot(relations_graph)
|
353 |
|
354 |
##################################################################################################
|
355 |
def get_chatbot_response(input_text):
|
|
|
304 |
'file_uploader': "Cargar archivo de texto",
|
305 |
'analyze_button': "Analizar texto",
|
306 |
'context_analysis': "Análisis de Contexto",
|
307 |
+
'semantic_relations': "Relaciones Semánticas Relevantes",
|
308 |
+
'entities_list': "Lista de Entidades", # Nueva etiqueta
|
309 |
},
|
310 |
'en': {
|
311 |
'title': "AIdeaText - Semantic Analysis",
|
312 |
'file_uploader': "Upload text file",
|
313 |
'analyze_button': "Analyze text",
|
314 |
'context_analysis': "Context Analysis",
|
315 |
+
'semantic_relations': "Relevant Semantic Relations",
|
316 |
+
'entities_list': "Entities List", # Nueva etiqueta
|
317 |
},
|
318 |
'fr': {
|
319 |
'title': "AIdeaText - Analyse sémantique",
|
320 |
'file_uploader': "Télécharger le fichier texte",
|
321 |
'analyze_button': "Analyser le texte",
|
322 |
'context_analysis': "Analyse de Contexte",
|
323 |
+
'semantic_relations': "Relations Sémantiques Pertinentes",
|
324 |
+
'entities_list': "Liste des Entités", # Nueva etiqueta
|
325 |
}
|
326 |
}
|
327 |
|
|
|
335 |
text_content = uploaded_file.getvalue().decode('utf-8')
|
336 |
|
337 |
if st.button(t['analyze_button']):
|
338 |
+
context_graph, relations_graph, entities = perform_semantic_analysis(text_content, nlp_models[lang_code], lang_code)
|
339 |
+
|
340 |
+
col1, col2 = st.columns([1, 3])
|
341 |
+
|
342 |
+
with col1:
|
343 |
+
st.subheader(t['entities_list'])
|
344 |
+
for category, items in entities.items():
|
345 |
+
st.write(f"**{category}:**")
|
346 |
+
for item in items:
|
347 |
+
st.write(f"- {item}")
|
348 |
+
|
349 |
+
with col2:
|
350 |
+
with st.expander(t['context_analysis'], expanded=True):
|
351 |
+
st.pyplot(context_graph)
|
352 |
+
|
353 |
+
with st.expander(t['semantic_relations'], expanded=True):
|
354 |
+
st.pyplot(relations_graph)
|
|
|
355 |
|
356 |
##################################################################################################
|
357 |
def get_chatbot_response(input_text):
|