Spaces:
Sleeping
Sleeping
KrSharangrav
commited on
Commit
·
3a2e6c2
1
Parent(s):
a610a88
change in UI
Browse files
app.py
CHANGED
@@ -10,20 +10,23 @@ insert_data_if_empty()
|
|
10 |
collection = get_mongo_client()
|
11 |
|
12 |
st.subheader("💬 Chatbot with Sentiment Analysis & Category Extraction")
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
)
|
|
|
|
|
|
|
|
|
17 |
|
18 |
if st.button("Get Response"):
|
19 |
ai_response, sentiment_label, sentiment_confidence, topic_label, topic_confidence = chatbot_response(user_prompt)
|
20 |
if ai_response:
|
21 |
st.write("### Response:")
|
22 |
-
st.
|
23 |
st.write("### Sentiment Analysis:")
|
24 |
-
|
25 |
-
st.write(f"**Sentiment Detected:** {sentiment_label} ({sentiment_confidence * 100:.0f}% confidence)")
|
26 |
st.write("### Category Extraction:")
|
27 |
-
st.write(f"**Category Detected:** {topic_label} ({topic_confidence
|
28 |
else:
|
29 |
st.warning("⚠️ Please enter a question or text for analysis.")
|
|
|
10 |
collection = get_mongo_client()
|
11 |
|
12 |
st.subheader("💬 Chatbot with Sentiment Analysis & Category Extraction")
|
13 |
+
|
14 |
+
# Create an expander to display example questions on separate lines.
|
15 |
+
with st.expander("Example Questions"):
|
16 |
+
st.write("• Provide analysis for data entry 1 in the dataset")
|
17 |
+
st.write("• What is the dataset summary?")
|
18 |
+
|
19 |
+
# Text area for user input.
|
20 |
+
user_prompt = st.text_area("Ask me something:")
|
21 |
|
22 |
if st.button("Get Response"):
|
23 |
ai_response, sentiment_label, sentiment_confidence, topic_label, topic_confidence = chatbot_response(user_prompt)
|
24 |
if ai_response:
|
25 |
st.write("### Response:")
|
26 |
+
st.markdown(ai_response)
|
27 |
st.write("### Sentiment Analysis:")
|
28 |
+
st.write(f"**Sentiment Detected:** {sentiment_label} ({sentiment_confidence:.2f} confidence)")
|
|
|
29 |
st.write("### Category Extraction:")
|
30 |
+
st.write(f"**Category Detected:** {topic_label} ({topic_confidence:.2f} confidence)")
|
31 |
else:
|
32 |
st.warning("⚠️ Please enter a question or text for analysis.")
|