blazingbunny commited on
Commit
d3f1fde
·
verified ·
1 Parent(s): 2e17500

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -27,12 +27,14 @@ def display_sentiment_results(annotations):
27
  # Loop through the sentences and display sentiment score with 2 decimal places
28
  for index, sentence in enumerate(annotations.sentences):
29
  sentence_sentiment = sentence.sentiment.score
 
30
  sentence_text = sentence.text.content # Get the text of the sentence
31
- st.write(f"Sentence {index} sentiment score: {sentence_sentiment:.2f}; magnitude: {magnitude:.2f}")
32
  st.write(f"Text from Sentence {index}: {sentence_text}") # Display the text of the sentence
33
 
34
  # Display overall sentiment with 2 decimal places
35
  st.write(f"Overall Sentiment: score of {score} with magnitude of {magnitude}")
 
36
 
37
  # Main function to run the app
38
  def main():
 
27
  # Loop through the sentences and display sentiment score with 2 decimal places
28
  for index, sentence in enumerate(annotations.sentences):
29
  sentence_sentiment = sentence.sentiment.score
30
+ sentence_magnitude = sentence.sentiment.magnitude # Get the sentence-level magnitude
31
  sentence_text = sentence.text.content # Get the text of the sentence
32
+ st.write(f"Sentence {index} sentiment score: {sentence_sentiment:.2f}; magnitude: {sentence_magnitude:.2f}")
33
  st.write(f"Text from Sentence {index}: {sentence_text}") # Display the text of the sentence
34
 
35
  # Display overall sentiment with 2 decimal places
36
  st.write(f"Overall Sentiment: score of {score} with magnitude of {magnitude}")
37
+
38
 
39
  # Main function to run the app
40
  def main():