Spaces:
Build error
Build error
| import streamlit as st | |
| from transformers import pipeline | |
| st.title("Sentiment Analysis App") | |
| # Load sentiment analysis model from Hugging Face | |
| sentiment_analyzer = pipeline("sentiment-analysis") | |
| # User input | |
| sample = st.text_area("Enter a sentence for sentiment analysis:") | |
| # Predict and display result | |
| if st.button("Predict"): | |
| prediction = sentiment_analyzer(sample)[0] | |
| st.success(f"Sentiment: {prediction['label']} with confidence: {prediction['score']:.2f}") | |