Spaces:
Running
Running
KrSharangrav
commited on
Commit
·
03c6c0d
1
Parent(s):
8491c18
New layout
Browse files
app.py
CHANGED
@@ -34,13 +34,17 @@ with st.expander("👋 Hi, allow me to help you with prompts:"):
|
|
34 |
user_prompt = st.text_area("Ask me something:")
|
35 |
|
36 |
if st.button("Get Response"):
|
37 |
-
|
38 |
-
if
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
|
34 |
user_prompt = st.text_area("Ask me something:")
|
35 |
|
36 |
if st.button("Get Response"):
|
37 |
+
# Check if user has entered text
|
38 |
+
if not user_prompt.strip():
|
39 |
+
st.warning("⚠️ Please enter a question or text for analysis.")
|
40 |
+
else:
|
41 |
+
ai_response, sentiment_label, sentiment_confidence, topic_label, topic_confidence = chatbot_response(user_prompt)
|
42 |
+
if ai_response:
|
43 |
+
st.write("### Response:")
|
44 |
+
st.markdown(ai_response)
|
45 |
+
st.write("### Sentiment Analysis:")
|
46 |
+
st.write(f"**Sentiment Detected:** {sentiment_label} ({sentiment_confidence * 100:.2f}% confidence)")
|
47 |
+
st.write("### Category Extraction:")
|
48 |
+
st.write(f"**Category Detected:** {topic_label} ({topic_confidence * 100:.2f}% confidence)")
|
49 |
+
else:
|
50 |
+
st.warning("⚠️ Unable to generate a response. Please try again.")
|