import streamlit as st from transformers import pipeline # Load Hugging Face model model_name = "distilbert-base-uncased-finetuned-sst-2-english" classifier = pipeline("sentiment-analysis", model=model_name) # Streamlit UI st.title("🤖 Sentiment Analysis App") st.write("Enter some English text below to analyze sentiment.") user_input = st.text_area("Text input", height=150) if st.button("Predict"): if user_input.strip() == "": st.warning("Please enter some text.") else: with st.spinner("Analyzing..."): result = classifier(user_input)[0] st.success(f"**Label**: {result['label']} \n**Confidence**: {result['score']:.4f}")