| import torch | |
| from transformers import pipeline | |
| import streamlit as st | |
| sentiment_pipeline = pipeline("sentiment-analysis") | |
| st.title("Sentiment Analysis") | |
| sentance = st.text_input("Enter a sentance to analyse") | |
| st.button("submit") | |
| if st.button: | |
| result = sentiment_pipeline(sentance) | |
| sentiment = result[0]['label'] | |
| confidence = result[0]['score'] | |
| st.write(f"Sentiment: {sentiment}") | |
| st.write(f"Confidence: {confidence}") | |