Update modules/ui.py
Browse files- modules/ui.py +18 -7
modules/ui.py
CHANGED
|
@@ -332,13 +332,24 @@ 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 |
-
st.
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 342 |
|
| 343 |
##################################################################################################
|
| 344 |
def get_chatbot_response(input_text):
|
|
|
|
| 332 |
text_content = uploaded_file.getvalue().decode('utf-8')
|
| 333 |
|
| 334 |
if st.button(t['analyze_button']):
|
| 335 |
+
if text_content:
|
| 336 |
+
context_graph, relations_graph, entities = perform_semantic_analysis(text_content, nlp_models[lang_code], lang_code)
|
| 337 |
+
|
| 338 |
+
col1, col2 = st.columns([1, 3])
|
| 339 |
+
|
| 340 |
+
with col1:
|
| 341 |
+
st.subheader(t['entities_list'])
|
| 342 |
+
for category, items in entities.items():
|
| 343 |
+
st.write(f"**{category}:**")
|
| 344 |
+
for item in items:
|
| 345 |
+
st.write(f"- {item}")
|
| 346 |
+
|
| 347 |
+
with col2:
|
| 348 |
+
with st.expander(t['context_analysis'], expanded=True):
|
| 349 |
+
st.pyplot(context_graph)
|
| 350 |
+
|
| 351 |
+
with st.expander(t['semantic_relations'], expanded=True):
|
| 352 |
+
st.pyplot(relations_graph)
|
| 353 |
|
| 354 |
##################################################################################################
|
| 355 |
def get_chatbot_response(input_text):
|