File size: 451 Bytes
45522c0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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}")