Spaces:
Sleeping
Sleeping
Changed the buttons position
Browse files
app.py
CHANGED
|
@@ -78,10 +78,10 @@ def return_top_k(sentence, k=10, word=None, rels=False):
|
|
| 78 |
predictions = [tokenizer.decode(tokens, skip_special_tokens=True) for tokens in output_sequences['sequences']]
|
| 79 |
probabilities = [round(float(prob), 2) for prob in decoded_probabilities]
|
| 80 |
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
|
| 86 |
return predictions[:10]
|
| 87 |
|
|
@@ -303,8 +303,8 @@ if st.session_state.actions[-1] == 'cue':
|
|
| 303 |
word_count = st.session_state.counters["word_count"]
|
| 304 |
target = st.session_state.results["results"][word_count]
|
| 305 |
|
| 306 |
-
col1, col2, col3, col4,
|
| 307 |
-
|
| 308 |
|
| 309 |
with col1:
|
| 310 |
b1 = st.button("Next letter", key="1")
|
|
@@ -320,13 +320,9 @@ if st.session_state.actions[-1] == 'cue':
|
|
| 320 |
# avail_cues = get_available_cues(target)
|
| 321 |
#cues_buttons = {cue_type: st.button(cue_type) for cue_type in avail_cues}
|
| 322 |
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
b6 = st.button("Exit", key="5", type='primary')
|
| 327 |
-
|
| 328 |
-
with col7:
|
| 329 |
-
new = st.button('Play again', key=64)
|
| 330 |
|
| 331 |
if b1:
|
| 332 |
st.session_state.counters["letter_count"] += 1
|
|
|
|
| 78 |
predictions = [tokenizer.decode(tokens, skip_special_tokens=True) for tokens in output_sequences['sequences']]
|
| 79 |
probabilities = [round(float(prob), 2) for prob in decoded_probabilities]
|
| 80 |
|
| 81 |
+
stripped_sent = [remove_punctuation(word.lower()) for word in sentence.split()]
|
| 82 |
+
for pred in predictions:
|
| 83 |
+
if (len(pred) < 2) | (pred in stripped_sent):
|
| 84 |
+
predictions.pop(predictions.index(pred))
|
| 85 |
|
| 86 |
return predictions[:10]
|
| 87 |
|
|
|
|
| 303 |
word_count = st.session_state.counters["word_count"]
|
| 304 |
target = st.session_state.results["results"][word_count]
|
| 305 |
|
| 306 |
+
col1, col2, col3, col4, col5 = st.columns(5)
|
| 307 |
+
|
| 308 |
|
| 309 |
with col1:
|
| 310 |
b1 = st.button("Next letter", key="1")
|
|
|
|
| 320 |
# avail_cues = get_available_cues(target)
|
| 321 |
#cues_buttons = {cue_type: st.button(cue_type) for cue_type in avail_cues}
|
| 322 |
|
| 323 |
+
b5 = st.button("I remembered the word!", key="4", type='primary')
|
| 324 |
+
b6 = st.button("Exit", key="5", type='primary')
|
| 325 |
+
new = st.button('Play again', key=64)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 326 |
|
| 327 |
if b1:
|
| 328 |
st.session_state.counters["letter_count"] += 1
|