Spaces:
Build error
Build error
import streamlit as st | |
from transformers import pipeline | |
# Load the sentiment analysis model | |
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)}") | |