Spaces:
Sleeping
Sleeping
Bug fix
Browse files
app.py
CHANGED
@@ -128,23 +128,7 @@ def ask_if_helped():
|
|
128 |
write_bot("Please describe your word!")
|
129 |
# st.session_state.is_helpful['ask'] = False
|
130 |
|
131 |
-
|
132 |
-
a1 = st.button('Results', key=10)
|
133 |
-
a2 = st.button('Cue', key=11)
|
134 |
-
if a1:
|
135 |
-
write_bot("Here are my guesses about your word:")
|
136 |
-
st.write(st.session_state.results['results_print'])
|
137 |
-
time.sleep(1)
|
138 |
-
write_bot('Does it help you remember the word?', remember=False)
|
139 |
-
st.session_state.is_helpful['ask'] = True
|
140 |
-
elif a2:
|
141 |
-
write_bot(f'The first letter is {st.session_state.results["results"][0][0]}.')
|
142 |
-
time.sleep(1)
|
143 |
-
write_bot('Does it help you remember the word?', remember=False)
|
144 |
-
st.session_state.is_helpful['ask'] = True
|
145 |
-
|
146 |
-
if st.session_state.is_helpful['ask'] == True:
|
147 |
-
ask_if_helped()'''
|
148 |
|
149 |
# JS
|
150 |
def postproc_wn(related_words, syns=False):
|
@@ -299,73 +283,6 @@ if st.session_state.actions[-1] == "result":
|
|
299 |
if st.session_state.is_helpful['ask']:
|
300 |
ask_if_helped()
|
301 |
|
302 |
-
'''if st.session_state.actions[-1] == 'cue':
|
303 |
-
guessed = False
|
304 |
-
write_bot('What do you want to see?', remember=False, blink=False)
|
305 |
-
|
306 |
-
while guessed == False:
|
307 |
-
b1 = st.button("Next letter", key="1")
|
308 |
-
b2 = st.button("Next word", key="2")
|
309 |
-
|
310 |
-
# JS
|
311 |
-
word_count = st.session_state.counters["word_count"]
|
312 |
-
target = st.session_state.results["results"][word_count]
|
313 |
-
if get_available_cues(target):
|
314 |
-
avail_cues = get_available_cues(target)
|
315 |
-
cues_buttons = {}
|
316 |
-
for cue_type, cues in avail_cues.items():
|
317 |
-
#st.button(cue_type)
|
318 |
-
cues_buttons[cue_type] = st.button(cue_type)
|
319 |
-
|
320 |
-
b3 = st.button("All words", key="3")
|
321 |
-
b4 = st.button("I remembered the word!", key="4", type='primary')
|
322 |
-
b5 = st.button("Exit", key="5", type='primary')
|
323 |
-
|
324 |
-
if b1:
|
325 |
-
st.session_state.counters["letter_count"] += 1
|
326 |
-
word_count = st.session_state.counters["word_count"]
|
327 |
-
letter_count = st.session_state.counters["letter_count"]
|
328 |
-
write_bot(f'The word starts with {st.session_state.results["results"][word_count][:letter_count]}', remember=False)
|
329 |
-
|
330 |
-
elif b2:
|
331 |
-
st.session_state.counters["letter_count"] = 1
|
332 |
-
letter_count = st.session_state.counters["letter_count"]
|
333 |
-
st.session_state.counters["word_count"] += 1
|
334 |
-
word_count = st.session_state.counters["word_count"]
|
335 |
-
write_bot(f'The next word starts with {st.session_state.results["results"][word_count][:letter_count]}', remember=False)
|
336 |
-
|
337 |
-
elif "Synonyms" in cues_buttons and cues_buttons['Synonyms']:
|
338 |
-
write_bot(f'Here are synonyms for the current word: {", ".join(avail_cues["Synonyms"])}', remember=False)
|
339 |
-
|
340 |
-
elif "Hypernyms" in cues_buttons and cues_buttons['Hypernyms']:
|
341 |
-
write_bot(f'Here are hypernyms for the current word: {", ".join(avail_cues["Hypernyms"])}', remember=False)
|
342 |
-
|
343 |
-
elif "Hyponyms" in cues_buttons and cues_buttons['Hyponyms']:
|
344 |
-
write_bot(f'Here are hyponyms for the current word: {", ".join(avail_cues["Hyponyms"])}', remember=False)
|
345 |
-
|
346 |
-
elif "Examples" in cues_buttons and cues_buttons['Examples']:
|
347 |
-
write_bot(f'Here are example contexts for the current word: {", ".join(avail_cues["Examples"])}', remember=False)
|
348 |
-
|
349 |
-
elif b3:
|
350 |
-
write_bot(f"Here are all my guesses about your word: {st.session_state.results['results_print']}")
|
351 |
-
|
352 |
-
elif b4:
|
353 |
-
write_bot("Yay! I am happy I could be of help!")
|
354 |
-
new = st.button('Play again', key=63)
|
355 |
-
if new:
|
356 |
-
write_bot("Please describe your word!")
|
357 |
-
guessed = True
|
358 |
-
|
359 |
-
break
|
360 |
-
|
361 |
-
elif b5:
|
362 |
-
write_bot("I am sorry I couldn't help you this time. See you soon!")
|
363 |
-
st.session_state.actions.append('cue')
|
364 |
-
new = st.button('Play again', key=64)
|
365 |
-
if new:
|
366 |
-
write_bot("Please describe your word!")
|
367 |
-
break'''
|
368 |
-
|
369 |
# elif prompt == 'results':
|
370 |
# st.text("results")
|
371 |
# st.write("results")
|
|
|
128 |
write_bot("Please describe your word!")
|
129 |
# st.session_state.is_helpful['ask'] = False
|
130 |
|
131 |
+
## removed: if st.session_state.actions[-1] == "result":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
|
133 |
# JS
|
134 |
def postproc_wn(related_words, syns=False):
|
|
|
283 |
if st.session_state.is_helpful['ask']:
|
284 |
ask_if_helped()
|
285 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
# elif prompt == 'results':
|
287 |
# st.text("results")
|
288 |
# st.write("results")
|