| import streamlit as st | |
| from transformers import pipeline | |
| # Title and Subtitle | |
| st.title('Sentiment Analysis App') | |
| pipe=pipeline(model="dancingninjas/sentiment-model") | |
| text=st.text_area('Enter your text') | |
| if text: | |
| out = pipe(text) | |
| # Convert the model's output (0 or 1) to descriptive labels | |
| sentiment_label = "Positive" if out[0]['label'] == 'LABEL_1' else "Negative" | |
| # Display the sentiment label and probability | |
| st.write(f'Sentiment: {sentiment_label}') | |
| st.write(f'Probability: {out[0]["score"]:.4f}') | |