KrSharangrav commited on
Commit
da72d89
Β·
1 Parent(s): 2dc8def

more emojis added

Browse files
Files changed (2) hide show
  1. app.py +3 -2
  2. chatbot.py +3 -3
app.py CHANGED
@@ -21,8 +21,9 @@ if st.button("Get Response"):
21
  st.write("### Response:")
22
  st.write(ai_response)
23
  st.write("### Sentiment Analysis:")
24
- st.write(f"**Sentiment Detected:** {sentiment_label} ({sentiment_confidence:.2f} confidence)")
 
25
  st.write("### Category Extraction:")
26
- st.write(f"**Category Detected:** {topic_label} ({topic_confidence:.2f} confidence)")
27
  else:
28
  st.warning("⚠️ Please enter a question or text for analysis.")
 
21
  st.write("### Response:")
22
  st.write(ai_response)
23
  st.write("### Sentiment Analysis:")
24
+ # Convert sentiment confidence to percentage format (e.g., 70% confidence)
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 * 100:.0f}% confidence)")
28
  else:
29
  st.warning("⚠️ Please enter a question or text for analysis.")
chatbot.py CHANGED
@@ -29,9 +29,9 @@ except Exception as e:
29
 
30
  # Predefined topic labels for classification
31
  TOPIC_LABELS = [
32
- "Technology", "Politics", "Business", "Sports", "Entertainment", "Health", "Science",
33
- "Education", "Finance", "Travel", "Food", "Environment", "Culture", "History", "Art",
34
- "Litreature", "Automotive", "Law", "Music", "Movies"
35
  ]
36
 
37
  def analyze_sentiment(text):
 
29
 
30
  # Predefined topic labels for classification
31
  TOPIC_LABELS = [
32
+ "Technology πŸ’»", "Politics πŸ›οΈ", "Business πŸ’Ό", "Sports ⚽", "Entertainment 🎭", "Health 🩺",
33
+ "Science πŸ”¬", "Education πŸŽ“", "Finance πŸ’°", "Travel ✈️", "Food πŸ”", "Environment 🌱", "Culture 🎎",
34
+ "History 🏺", "Art 🎨", "Literature πŸ“š", "Automotive πŸš—", "Law βš–οΈ", "Music 🎡", "Movies 🎬"
35
  ]
36
 
37
  def analyze_sentiment(text):