import streamlit as st from transformers import pipeline # Set page layout and style st.set_page_config( page_title="Sentiment Analysis", layout="wide", initial_sidebar_state="expanded", ) st.markdown( """ """, unsafe_allow_html=True, ) # Set up sentiment analysis pipeline pipe = pipeline("sentiment-analysis") # Streamlit app st.title("Sentiment Analysis") text = st.text_area("Enter text") if st.button("Analyze"): if text: out = pipe(text) st.subheader("Sentiment Analysis Result:") for result in out: sentiment = result["label"] score = result["score"] st.write(f"- Sentiment: {sentiment}, Score: {score:.2f}") else: st.warning("Please enter some text.")