File size: 548 Bytes
aa7f5a4
 
 
 
 
 
 
734dda1
3925f77
 
 
 
734dda1
 
 
aa7f5a4
 
13c3404
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import streamlit as st  #Web App
from transformers import pipeline

#title
st.title("Sentiment Analysis - Classify Sentiment of text")

data = []
text = st.text_input("Enter text here:","Artificial Intelligence is useful")
if st.button("Run Sentiment Analysis of Text"): 
    data.append(text)
    sentiment_pipeline = pipeline("sentiment-analysis")
    result = sentiment_pipeline(data)
    label = result[0]["label"]
    score = result[0]["score"]
    st.write("The classification of the given text is " + label + " with a score of " + score)