Spaces:
Running
Running
KrSharangrav
commited on
Commit
Β·
da72d89
1
Parent(s):
2dc8def
more emojis added
Browse files- app.py +3 -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 |
-
|
|
|
25 |
st.write("### Category Extraction:")
|
26 |
-
st.write(f"**Category Detected:** {topic_label} ({topic_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
|
33 |
-
"Education", "Finance", "Travel", "Food", "Environment", "Culture
|
34 |
-
"
|
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):
|