Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| from transformers import pipeline | |
| def load_pipeline(): | |
| return pipeline("sentiment-analysis") | |
| classifier = load_pipeline() | |
| st.title("Sentiment Analysis App") | |
| st.write("Enter a sentence to analyze its sentiment.") | |
| user_input = st.text_input("Sentence:", "") | |
| if st.button("Analyze"): | |
| if user_input: | |
| result = classifier(user_input) | |
| st.write("Sentiment:", result[0]['label']) | |
| st.write("Confidence:", result[0]['score']) | |
| else: | |
| st.write("Please enter a sentence to analyze.") | |