import streamlit as st import torch # Use a pipeline as a high-level helper from transformers import pipeline text_classification = pipeline("text-classification", model="distilbert/distilbert-base-uncased-finetuned-sst-2-english") def sentment_classifiction(text): output = text_classification(text) return output[0]['label'] # Streamlit UI def run(): st.title("Sentiment Analysis") st.write("Enter a comment below to analyze its sentiment.") text = st.text_area("Enter your text here:", "") if st.button("Analyze"): if text: with st.spinner("Analyzing the text..."): result = sentment_classifiction(text) st.success(f"**Sentiment:** {result}") else: st.warning("⚠️ Please enter some text for analysis.")