schlenker commited on
Commit
a0c7209
·
1 Parent(s): 32624f0

count states change

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -139,13 +139,14 @@ def ask_if_helped():
139
  new = st.button('I have a new word', key=62)
140
  if y:
141
  write_bot("I am happy to help!")
 
142
  elif n:
143
  st.session_state.actions.append('cue')
144
  st.session_state.is_helpful['ask'] = False
145
  #cue_generation()
146
  elif new:
147
  write_bot("Please describe your word!")
148
- # st.session_state.is_helpful['ask'] = False
149
 
150
  ## removed: if st.session_state.actions[-1] == "result":
151
 
@@ -338,17 +339,23 @@ if st.session_state.actions[-1] == 'cue':
338
  write_bot(f'This is my predicted word: "{target}". Does this match your query?')
339
  ask_if_helped()
340
 
341
-
342
  elif b2:
343
  rels = return_top_k(st.session_state.descriptions[-1], word=target, rels=True)
344
- write_bot(f'Here are words that are related to your word: {", ".join(rels)}')
 
345
 
346
  elif b3:
347
  st.session_state.counters["letter_count"] = 1
348
  letter_count = st.session_state.counters["letter_count"]
349
  st.session_state.counters["word_count"] += 1
350
  word_count = st.session_state.counters["word_count"]
351
- write_bot(f'The next word starts with {st.session_state.results["results"][word_count][:letter_count]}', remember=False)
 
 
 
 
 
 
352
 
353
  #elif get_available_cues(target) and "Synonyms" in cues_buttons and cues_buttons['Synonyms']:
354
  #write_bot(f'Here are synonyms for the current word: {", ".join(avail_cues["Synonyms"])}', remember=False)
 
139
  new = st.button('I have a new word', key=62)
140
  if y:
141
  write_bot("I am happy to help!")
142
+ st.session_state.is_helpful['ask'] = False
143
  elif n:
144
  st.session_state.actions.append('cue')
145
  st.session_state.is_helpful['ask'] = False
146
  #cue_generation()
147
  elif new:
148
  write_bot("Please describe your word!")
149
+ st.session_state.is_helpful['ask'] = False
150
 
151
  ## removed: if st.session_state.actions[-1] == "result":
152
 
 
339
  write_bot(f'This is my predicted word: "{target}". Does this match your query?')
340
  ask_if_helped()
341
 
 
342
  elif b2:
343
  rels = return_top_k(st.session_state.descriptions[-1], word=target, rels=True)
344
+ write_bot(f'Here are words that are related to your word: {", ".join(rels)}. \n Does this help you remember the word?', remember=False)
345
+ ask_if_helped()
346
 
347
  elif b3:
348
  st.session_state.counters["letter_count"] = 1
349
  letter_count = st.session_state.counters["letter_count"]
350
  st.session_state.counters["word_count"] += 1
351
  word_count = st.session_state.counters["word_count"]
352
+ #write_bot(f'The next word starts with {st.session_state.results["results"][word_count][:letter_count]}', remember=False)
353
+ if letter_count < len(target):
354
+ write_bot(f'The next word starts with {st.session_state.results["results"][word_count][:letter_count]}. \n Does this help you remember the word?', remember=False)
355
+ ask_if_helped()
356
+ else:
357
+ write_bot(f'This is my predicted word: "{target}". Does this match your query?')
358
+ ask_if_helped()
359
 
360
  #elif get_available_cues(target) and "Synonyms" in cues_buttons and cues_buttons['Synonyms']:
361
  #write_bot(f'Here are synonyms for the current word: {", ".join(avail_cues["Synonyms"])}', remember=False)