import streamlit as st from transformers import pipeline def analyze_sentiment(text): sentiment_pipe = pipeline("sentiment-analysis") result = sentiment_pipe(text) return result def main(): st.title("Sentiment Analysis App") st.write("Enter text for sentiment analysis 👍 👎") text = st.text_area("Text input") if st.button("Analyze Sentiment"): if text: sentiment_result = analyze_sentiment(text) sentiment_label = sentiment_result[0]['label'] sentiment_score = sentiment_result[0]['score'] st.write("Sentiment:", sentiment_label) st.write("Confidence Score:", sentiment_score) if __name__ == "__main__": main()