Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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
|
| 12 |
|
| 13 |
with gr.Blocks() as demo:
|
| 14 |
-
gr.Markdown(
|
|
|
|
|
|
|
|
|
|
| 15 |
with gr.Row():
|
| 16 |
inp = gr.Textbox(placeholder="Enter prompt")
|
| 17 |
-
|
| 18 |
-
|
|
|
|
| 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()
|