Spaces:
Build error
Build error
File size: 462 Bytes
af6ee2e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
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)}")
|