SwatGarg commited on
Commit
74743a4
·
verified ·
1 Parent(s): b9b342b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -39
app.py CHANGED
@@ -26,9 +26,7 @@ final_chain = mdl.create_final_chain()
26
  # Define states and actions
27
  states = [
28
  "Negative",
29
- "Moderately Negative",
30
  "Neutral",
31
- "Moderately Positive",
32
  "Positive",
33
  ]
34
 
@@ -79,10 +77,6 @@ if "messages" not in st.session_state:
79
  st.session_state.messages = []
80
  if "user_sentiment" not in st.session_state:
81
  st.session_state.user_sentiment = "Neutral"
82
- if "mood_trend" not in st.session_state:
83
- st.session_state.mood_trend = "Unchanged"
84
- if "mood_trend_symbol" not in st.session_state:
85
- st.session_state.mood_trend_symbol = ""
86
 
87
  # Layout of input/response containers
88
 
@@ -136,39 +130,7 @@ with input_container:
136
 
137
  # Detect sentiment
138
  user_sentiment = chatbot.detect_sentiment(user_message)
139
-
140
- # Update mood history / mood_trend
141
- chatbot.update_mood_history()
142
- mood_trend = chatbot.check_mood_trend()
143
-
144
- # Define rewards
145
- if user_sentiment in ["Positive", "Moderately Positive"]:
146
- if mood_trend == "increased":
147
- reward = +1
148
- mood_trend_symbol = " ⬆️"
149
- elif mood_trend == "unchanged":
150
- reward = +0.8
151
- mood_trend_symbol = ""
152
- else: # decreased
153
- reward = -0.2
154
- mood_trend_symbol = " ⬇️"
155
- else:
156
- if mood_trend == "increased":
157
- reward = +1
158
- mood_trend_symbol = " ⬆️"
159
- elif mood_trend == "unchanged":
160
- reward = -0.2
161
- mood_trend_symbol = ""
162
- else: # decreased
163
- reward = -1
164
- mood_trend_symbol = " ⬇️"
165
-
166
- print(f"mood_trend - sentiment - reward: {mood_trend} - {user_sentiment} - 🛑{reward}🛑")
167
-
168
-
169
- # Update Q-values
170
- chatbot.update_q_values(user_sentiment, reward, user_sentiment)
171
-
172
  # Display the AI's response
173
  with st.chat_message("ai"):
174
  st.markdown(response)
 
26
  # Define states and actions
27
  states = [
28
  "Negative",
 
29
  "Neutral",
 
30
  "Positive",
31
  ]
32
 
 
77
  st.session_state.messages = []
78
  if "user_sentiment" not in st.session_state:
79
  st.session_state.user_sentiment = "Neutral"
 
 
 
 
80
 
81
  # Layout of input/response containers
82
 
 
130
 
131
  # Detect sentiment
132
  user_sentiment = chatbot.detect_sentiment(user_message)
133
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  # Display the AI's response
135
  with st.chat_message("ai"):
136
  st.markdown(response)