Ariel Hsieh commited on
Commit
734dda1
1 Parent(s): 3925f77

update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -5,12 +5,14 @@ from transformers import pipeline
5
  st.title("Sentiment Analysis - Classify Sentiment of text")
6
 
7
  data = []
8
- text = st.text_input("Enter text here:","AI is fun")
9
  if st.button("Run Sentiment Analysis of Text"):
10
  data.append(text)
11
  sentiment_pipeline = pipeline("sentiment-analysis")
12
  result = sentiment_pipeline(data)
13
- st.write(result)
 
 
14
 
15
 
16
 
 
5
  st.title("Sentiment Analysis - Classify Sentiment of text")
6
 
7
  data = []
8
+ text = st.text_input("Enter text here:","Artificial Intelligence is useful")
9
  if st.button("Run Sentiment Analysis of Text"):
10
  data.append(text)
11
  sentiment_pipeline = pipeline("sentiment-analysis")
12
  result = sentiment_pipeline(data)
13
+ label = result[0]["label"]
14
+ score = result[0]["score"]
15
+ st.write("The classification of the given text is " + label + " with a score of " + score)
16
 
17
 
18