KrSharangrav commited on
Commit
03c6c0d
·
1 Parent(s): 8491c18

New layout

Browse files
Files changed (1) hide show
  1. app.py +14 -10
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
- ai_response, sentiment_label, sentiment_confidence, topic_label, topic_confidence = chatbot_response(user_prompt)
38
- if ai_response:
39
- st.write("### Response:")
40
- st.markdown(ai_response)
41
- st.write("### Sentiment Analysis:")
42
- st.write(f"**Sentiment Detected:** {sentiment_label} ({sentiment_confidence:.2f} confidence)")
43
- st.write("### Category Extraction:")
44
- st.write(f"**Category Detected:** {topic_label} ({topic_confidence:.2f} confidence)")
45
- else:
46
- st.warning("⚠️ Please enter a question or text for analysis.")
 
 
 
 
 
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.")