Spaces:
Sleeping
Sleeping
Added the bot's response in case the user doesn't say yes or no
Browse files
pages/1_Descriptive_chatbot.py
CHANGED
@@ -257,15 +257,17 @@ for message in st.session_state.messages:
|
|
257 |
#display user message in chat message container
|
258 |
prompt = get_text()
|
259 |
if prompt:
|
260 |
-
#JS: would replace Simon by some neutral character
|
261 |
with st.chat_message('user', avatar='nursulu.jpg'):
|
262 |
st.markdown(prompt)
|
263 |
#add to history
|
264 |
st.session_state.messages.append({'role': 'user', 'content': prompt})
|
265 |
#TODO: replace it with zero-shot classifier
|
266 |
-
yes = ['yes', 'again', '
|
267 |
-
|
|
|
268 |
write_bot("Please describe your word!")
|
|
|
|
|
269 |
elif prompt == 'it is similar to the best place on earth':
|
270 |
write_bot("Great! Let me think what it could be...")
|
271 |
time.sleep(3)
|
@@ -278,6 +280,8 @@ if prompt:
|
|
278 |
st.session_state.results['results_print'] = dict(zip(range(1, 11), st.session_state.results['results']))
|
279 |
write_bot("I think I have some ideas. Do you want to see my guesses or do you want a cue?")
|
280 |
st.session_state.actions.append("result")
|
|
|
|
|
281 |
|
282 |
if st.session_state.actions[-1] == "result":
|
283 |
col1, col2, col3, col4, col5 = st.columns(5)
|
|
|
257 |
#display user message in chat message container
|
258 |
prompt = get_text()
|
259 |
if prompt:
|
|
|
260 |
with st.chat_message('user', avatar='nursulu.jpg'):
|
261 |
st.markdown(prompt)
|
262 |
#add to history
|
263 |
st.session_state.messages.append({'role': 'user', 'content': prompt})
|
264 |
#TODO: replace it with zero-shot classifier
|
265 |
+
yes = ['yes', 'again', 'sure', 'new word', 'yes!', 'yep', 'yeah']
|
266 |
+
no = ['no', 'nope', 'nah']
|
267 |
+
if prompt.lower() in yes:
|
268 |
write_bot("Please describe your word!")
|
269 |
+
elif prompt.lower() in no:
|
270 |
+
write_bot("Okay, see you next time then! :innocent:")
|
271 |
elif prompt == 'it is similar to the best place on earth':
|
272 |
write_bot("Great! Let me think what it could be...")
|
273 |
time.sleep(3)
|
|
|
280 |
st.session_state.results['results_print'] = dict(zip(range(1, 11), st.session_state.results['results']))
|
281 |
write_bot("I think I have some ideas. Do you want to see my guesses or do you want a cue?")
|
282 |
st.session_state.actions.append("result")
|
283 |
+
else:
|
284 |
+
write_bot("Sorry, I didn't understand you... I am still learning :sob: For now, could you respond with 'yes' or 'no'? ")
|
285 |
|
286 |
if st.session_state.actions[-1] == "result":
|
287 |
col1, col2, col3, col4, col5 = st.columns(5)
|