khandelwalkishna15 commited on
Commit
c6b8ea5
1 Parent(s): 40c7739

app.py file added

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -22,8 +22,8 @@ def predict_sentiment(text):
22
 
23
  # Button to trigger sentiment analysis
24
  if st.button("Analyze Sentiment"):
25
- # Check if the input text is not empty
26
- if text_input and text_input.strip(): # Check if input is not empty or contains only whitespaces
27
  # Showing loading spinner while processing
28
  with st.spinner("Analyzing sentiment..."):
29
  sentiment = predict_sentiment(text_input)
@@ -36,7 +36,7 @@ if st.button("Analyze Sentiment"):
36
  # Considering a threshold for sentiment prediction
37
  threshold = 0.5
38
 
39
- # Change the success message background color based on sentiment and threshold
40
  if sentiment == 'Positive' and confidence_scores[2] > threshold:
41
  st.success(f"Sentiment: {sentiment} (Confidence: {confidence_scores[2]:.3f})")
42
  elif sentiment == 'Negative' and confidence_scores[0] > threshold:
 
22
 
23
  # Button to trigger sentiment analysis
24
  if st.button("Analyze Sentiment"):
25
+ # Checking if the input text is not empty
26
+ if text_input and text_input.strip(): # Checking if input is not empty or contains only whitespaces
27
  # Showing loading spinner while processing
28
  with st.spinner("Analyzing sentiment..."):
29
  sentiment = predict_sentiment(text_input)
 
36
  # Considering a threshold for sentiment prediction
37
  threshold = 0.5
38
 
39
+ # Changing the success message background color based on sentiment and threshold
40
  if sentiment == 'Positive' and confidence_scores[2] > threshold:
41
  st.success(f"Sentiment: {sentiment} (Confidence: {confidence_scores[2]:.3f})")
42
  elif sentiment == 'Negative' and confidence_scores[0] > threshold: