Nev1111's picture
Upload 3 files
af6ee2e verified
raw
history blame contribute delete
462 Bytes
import streamlit as st
from transformers import pipeline
# Load the sentiment analysis model
@st.cache_resource
def load_model():
return pipeline("sentiment-analysis")
model = load_model()
# Streamlit interface
st.title("🧠 Sentiment Analyzer")
user_input = st.text_area("Enter a sentence:")
if user_input:
result = model(user_input)[0]
st.write(f"**Sentiment:** {result['label']}")
st.write(f"**Confidence:** {round(result['score'], 4)}")