taka-yamakoshi commited on
Commit
145f48c
1 Parent(s): dc80c0d

decode the whole string

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -51,8 +51,8 @@ def DeTokenizeText(input_str):
51
  if len(input_str)>0:
52
  input_sent = [int(element) for element in input_str.strip().split(' ')]
53
  encoded_sent = [str(token) for token in input_sent]
54
- decoded_sent = [tokenizer.decode([token]) for token in input_sent]
55
- num_tokens = len(decoded_sent)
56
 
57
  #char_nums = [len(word)+2 for word in decoded_sent]
58
  #word_cols = st.columns(char_nums)
@@ -61,7 +61,7 @@ def DeTokenizeText(input_str):
61
  #st.write(word)
62
  #st.write(' '.join(encoded_sent))
63
  #st.write(' '.join(decoded_sent))
64
- st.markdown(generate_markdown(' '.join(decoded_sent)), unsafe_allow_html=True)
65
  return num_tokens
66
 
67
  if __name__=='__main__':
 
51
  if len(input_str)>0:
52
  input_sent = [int(element) for element in input_str.strip().split(' ')]
53
  encoded_sent = [str(token) for token in input_sent]
54
+ decoded_sent = tokenizer.decode(input_sent)
55
+ num_tokens = len(input_sent)
56
 
57
  #char_nums = [len(word)+2 for word in decoded_sent]
58
  #word_cols = st.columns(char_nums)
 
61
  #st.write(word)
62
  #st.write(' '.join(encoded_sent))
63
  #st.write(' '.join(decoded_sent))
64
+ st.markdown(generate_markdown(decoded_sent), unsafe_allow_html=True)
65
  return num_tokens
66
 
67
  if __name__=='__main__':