File size: 534 Bytes
483dd11 3114278 483dd11 3114278 b5b3b26 c06f677 3114278 c06f677 3114278 f90c3a5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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}')
|