rubend18 commited on
Commit
bec5cd0
1 Parent(s): 0b30c3c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -5,7 +5,8 @@ encodings = tiktoken.list_encoding_names()
5
  encodings.reverse()
6
 
7
  def function(input, encoding):
8
- tokens = tiktoken.get_encoding(encoding).encode(input)
 
9
  return len(tokens)
10
 
11
  value1 = gr.Textbox(lines=6, label="Input", placeholder="Input the text...")
 
5
  encodings.reverse()
6
 
7
  def function(input, encoding):
8
+ tokenizer = tiktoken.get_encoding(encoding)
9
+ tokens = tokenizer.encode(input)
10
  return len(tokens)
11
 
12
  value1 = gr.Textbox(lines=6, label="Input", placeholder="Input the text...")