Benjy commited on
Commit
84c8a10
·
verified ·
1 Parent(s): a559408

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -12,13 +12,14 @@ st.write("Enter text below to analyze sentiment:")
12
  user_input = st.text_area("Text input")
13
 
14
  # Button to perform sentiment analysis
15
- if st.button("Analyze Sentiment"):
16
  if user_input:
17
  # Perform sentiment analysis
18
  results = sentiment_pipeline(user_input)
19
  # Display the results
20
  sentiment = results[0]['label']
21
  score = results[0]['score']
22
- st.write(f"Sentiment: {sentiment} (Confidence: {score:.2f})")
 
23
  else:
24
  st.write("Please enter some text to analyze.")
 
12
  user_input = st.text_area("Text input")
13
 
14
  # Button to perform sentiment analysis
15
+ if st.button("Analyse Sentiment"):
16
  if user_input:
17
  # Perform sentiment analysis
18
  results = sentiment_pipeline(user_input)
19
  # Display the results
20
  sentiment = results[0]['label']
21
  score = results[0]['score']
22
+ confidence_percentage = score * 100
23
+ st.write(f"Sentiment: {sentiment} (Confidence: {confidence_percentage:.2f}%)")
24
  else:
25
  st.write("Please enter some text to analyze.")