Spaces:
Running
Running
Deal with multi-word predictions
Browse files- pages/1_Rewrite.py +6 -2
pages/1_Rewrite.py
CHANGED
|
@@ -25,7 +25,11 @@ def append_token(word):
|
|
| 25 |
st.session_state['rewrite_in_progress'] + word
|
| 26 |
)
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
| 29 |
with col:
|
| 30 |
-
|
|
|
|
|
|
|
| 31 |
|
|
|
|
| 25 |
st.session_state['rewrite_in_progress'] + word
|
| 26 |
)
|
| 27 |
|
| 28 |
+
allow_multi_word = st.checkbox("Allow multi-word predictions", value=False)
|
| 29 |
+
|
| 30 |
+
for i, (col, token) in enumerate(zip(st.columns(len(tokens)), tokens)):
|
| 31 |
with col:
|
| 32 |
+
if not allow_multi_word and ' ' in token[1:]:
|
| 33 |
+
token = token[0] + token[1:].split(' ', 1)[0]
|
| 34 |
+
st.button(token, on_click=append_token, args=(token,), key=i)
|
| 35 |
|