import streamlit as st from transformers import pipeline # Set up the sentiment analysis pipeline pipe = pipeline("sentiment-analysis") # Create a header for the app st.set_page_config(page_title="Sentiment Analysis", page_icon=":chart_with_upwards_trend:", layout="wide") st.title("Sentiment Analysis for Text") # Add a text area for user input text = st.text_area("Enter your text:", height=150) # Add a button for processing the input if st.button("Check Sentiment", key="check_button"): if text: with st.spinner('Analyzing...'): out = pipe(text) st.json(out) else: st.error("Please add text before checking sentiment!") # Add some additional styling st.markdown( """ """, unsafe_allow_html=True )