wendywu commited on
Commit
c3f9b5c
·
1 Parent(s): 5af1990

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -55,9 +55,12 @@ if "messages" not in st.session_state:
55
 
56
  if user_input := st.chat_input("Say something"):
57
  assistant_input = get_response(user_input)
 
58
 
 
 
59
  # add user input to history
60
- st.session_state.messages.append({"role": "user", "content": user_input})
61
 
62
  # add assistant input to history
63
  st.session_state.messages.append({"role": "assistant", "content": assistant_input})
@@ -65,7 +68,7 @@ if user_input := st.chat_input("Say something"):
65
 
66
 
67
  # sentiment analysis
68
- sentiment, prob = get_sentiment(user_input, nlp)
69
  if sentiment == "very negative":
70
  rain(
71
  emoji="😭",
 
55
 
56
  if user_input := st.chat_input("Say something"):
57
  assistant_input = get_response(user_input)
58
+ sentiment, prob = get_sentiment(user_input, nlp)
59
 
60
+ sentiment_analysis = f" (sentiment:{sentiment},score:{prob})"
61
+
62
  # add user input to history
63
+ st.session_state.messages.append({"role": "user", "content": user_input + sentiment_analysis})
64
 
65
  # add assistant input to history
66
  st.session_state.messages.append({"role": "assistant", "content": assistant_input})
 
68
 
69
 
70
  # sentiment analysis
71
+
72
  if sentiment == "very negative":
73
  rain(
74
  emoji="😭",