teragron commited on
Commit
22e320d
·
1 Parent(s): aa95a24

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -8,14 +8,18 @@ tokenizer = LlamaTokenizer.from_pretrained("llama_tokenizer")
8
  def tokenize(prompt):
9
  tokens = tokenizer.encode(prompt, add_special_tokens=False)
10
  num_tokens = len(tokens)
11
- return ("Number of tokens:", num_tokens)
12
 
13
  with gr.Blocks() as demo:
14
- gr.Markdown("Token Counter for LLAMA")
 
 
 
15
  with gr.Row():
16
  inp = gr.Textbox(placeholder="Enter prompt")
17
- out = gr.Textbox()
18
- btn = gr.Button("Run")
 
19
  btn.click(fn=tokenize, inputs=inp, outputs=out)
20
 
21
  demo.launch()
 
8
  def tokenize(prompt):
9
  tokens = tokenizer.encode(prompt, add_special_tokens=False)
10
  num_tokens = len(tokens)
11
+ return num_tokens
12
 
13
  with gr.Blocks() as demo:
14
+ gr.Markdown(
15
+ """
16
+ # Token Counter for LLAMA
17
+ """)
18
  with gr.Row():
19
  inp = gr.Textbox(placeholder="Enter prompt")
20
+ with gr.Column():
21
+ out = gr.Textbox(label="Number of tokens")
22
+ btn = gr.Button("Run")
23
  btn.click(fn=tokenize, inputs=inp, outputs=out)
24
 
25
  demo.launch()