import streamlit as st from textblob import TextBlob # Streamlit page settings st.set_page_config(page_title="Sentimental App", layout="centered") # Title st.title("😊 Sentimental App") st.write("Analyze the sentiment of your text — positive, negative or neutral.") # Input from user user_input = st.text_area("Enter your text here:", height=150) # Sentiment analysis function def analyze_sentiment(text): blob = TextBlob(text) sentiment = blob.sentiment.polarity if sentiment > 0: return "Positive 😊" elif sentiment < 0: return "Negative 😠" else: return "Neutral 😐" # Analyze button if st.button("Analyze"): if user_input.strip() == "": st.warning("Please enter some text.") else: result = analyze_sentiment(user_input) st.subheader("Sentiment Result:") st.success(result)