đŦ Sentiment Analysis
", unsafe_allow_html=True)
st.markdown("Discover the sentiment behind your words!
", unsafe_allow_html=True)
text = st.text_area("Enter your text here:", height=150, placeholder="Type your sentence...")
if st.button("⨠Analyze Sentiment"):
if not text.strip():
st.warning("Please enter some text to analyze.")
else:
with st.spinner("Analyzing..."):
result = nlp(text)
label = result[0]['label']
score = result[0]['score']
st.markdown("", unsafe_allow_html=True)
if label == "POSITIVE":
st.markdown(f"đ Positive Sentiment
Confidence: {score:.2f}", unsafe_allow_html=True) elif label == "NEGATIVE": st.markdown(f"âšī¸ Negative Sentiment
Confidence: {score:.2f}", unsafe_allow_html=True) else: st.markdown(f"đ Neutral Sentiment
Confidence: {score:.2f}", unsafe_allow_html=True) st.markdown("
", unsafe_allow_html=True)
st.markdown("Confidence: {score:.2f}", unsafe_allow_html=True) elif label == "NEGATIVE": st.markdown(f"âšī¸ Negative Sentiment
Confidence: {score:.2f}", unsafe_allow_html=True) else: st.markdown(f"đ Neutral Sentiment
Confidence: {score:.2f}", unsafe_allow_html=True) st.markdown("