HishuJanu commited on
Commit
4ec4a3c
1 Parent(s): 440d662

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -61,18 +61,18 @@ def sentimentGenerator(text):
61
  analyzer = SentimentIntensityAnalyzer()
62
  result = analyzer.polarity_scores(text)
63
 
64
- if result['compound'] > 0.35:
65
- st.success("Sentiment is Positive")
66
- elif result['compound'] < (-0.25):
67
- st.error("Sentiment is Negative")
68
- else:
69
- st.info("Sentiment is Neutral")
70
- # if max(result['pos'],result['neu'],result['neg']) == result['pos']:
71
  # st.success("Sentiment is Positive")
72
- # elif max(result['pos'],result['neu'],result['neg']) == result['neg']:
73
  # st.error("Sentiment is Negative")
74
  # else:
75
  # st.info("Sentiment is Neutral")
 
 
 
 
 
 
76
 
77
  st.write(f"Positive - {round(result['pos']*100,2)}%")
78
  st.write(f"Neutral - {round(result['neu']*100,2)}%")
 
61
  analyzer = SentimentIntensityAnalyzer()
62
  result = analyzer.polarity_scores(text)
63
 
64
+ # if result['compound'] > 0.35:
 
 
 
 
 
 
65
  # st.success("Sentiment is Positive")
66
+ # elif result['compound'] < (-0.25):
67
  # st.error("Sentiment is Negative")
68
  # else:
69
  # st.info("Sentiment is Neutral")
70
+ if max(result['pos'],result['neu'],result['neg']) == result['pos']:
71
+ st.success("Sentiment is Positive")
72
+ elif max(result['pos'],result['neu'],result['neg']) == result['neg']:
73
+ st.error("Sentiment is Negative")
74
+ else:
75
+ st.info("Sentiment is Neutral")
76
 
77
  st.write(f"Positive - {round(result['pos']*100,2)}%")
78
  st.write(f"Neutral - {round(result['neu']*100,2)}%")