Spaces:
Sleeping
Sleeping
fixed the previous commit a bit
Browse files- pages/1_Descriptive_chatbot.py +18 -17
pages/1_Descriptive_chatbot.py
CHANGED
@@ -264,23 +264,24 @@ if 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 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
|
|
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":
|
|
|
264 |
#TODO: replace it with zero-shot classifier
|
265 |
yes = ['yes', 'again', 'sure', 'new word', 'yes!', 'yep', 'yeah']
|
266 |
no = ['no', 'nope', 'nah']
|
267 |
+
try:
|
268 |
+
if prompt.lower() in yes:
|
269 |
+
write_bot("Please describe your word!")
|
270 |
+
elif prompt.lower() in no:
|
271 |
+
write_bot("Okay, see you next time then! :innocent:")
|
272 |
+
elif prompt == 'it is similar to the best place on earth':
|
273 |
+
write_bot("Great! Let me think what it could be...")
|
274 |
+
time.sleep(3)
|
275 |
+
write_bot("Do you mean Saarland?")
|
276 |
+
#if previously we asked to give a prompt
|
277 |
+
elif (st.session_state.messages[-2]['content'] == "Please describe your word!") & (st.session_state.messages[-1]['content'] != "no"):
|
278 |
+
write_bot("Great! Let me think what it could be...")
|
279 |
+
st.session_state.descriptions.append(prompt)
|
280 |
+
st.session_state.results['results'] = return_top_k(st.session_state.descriptions[-1])
|
281 |
+
st.session_state.results['results_print'] = dict(zip(range(1, 11), st.session_state.results['results']))
|
282 |
+
write_bot("I think I have some ideas. Do you want to see my guesses or do you want a cue?")
|
283 |
+
st.session_state.actions.append("result")
|
284 |
+
except:
|
285 |
write_bot("Sorry, I didn't understand you... I am still learning :sob: For now, could you respond with 'yes' or 'no'? ")
|
286 |
|
287 |
if st.session_state.actions[-1] == "result":
|