Spaces:
Sleeping
Sleeping
EMMA commited on
Commit ·
b8aa393
1
Parent(s): 3bcffd4
update code
Browse files
app.py
CHANGED
|
@@ -17,7 +17,6 @@ import nltk
|
|
| 17 |
import torch
|
| 18 |
import torch.nn.functional as F
|
| 19 |
import tiktoken
|
| 20 |
-
from benchmark_token_efficiency import run_benchmark
|
| 21 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 22 |
|
| 23 |
# ==========================================
|
|
@@ -742,7 +741,12 @@ body:has(.progress-level)::before {
|
|
| 742 |
with gr.Accordion("Developer / Benchmark Tools", open=False):
|
| 743 |
btn_run = gr.Button("Run Token Efficiency Benchmark")
|
| 744 |
output_text = gr.Markdown()
|
| 745 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 746 |
# ============================
|
| 747 |
|
| 748 |
# -------------------------------------------------------
|
|
|
|
| 17 |
import torch
|
| 18 |
import torch.nn.functional as F
|
| 19 |
import tiktoken
|
|
|
|
| 20 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 21 |
|
| 22 |
# ==========================================
|
|
|
|
| 741 |
with gr.Accordion("Developer / Benchmark Tools", open=False):
|
| 742 |
btn_run = gr.Button("Run Token Efficiency Benchmark")
|
| 743 |
output_text = gr.Markdown()
|
| 744 |
+
|
| 745 |
+
def _trigger_benchmark():
|
| 746 |
+
from benchmark_token_efficiency import run_benchmark
|
| 747 |
+
return run_benchmark()
|
| 748 |
+
|
| 749 |
+
btn_run.click(fn=_trigger_benchmark, outputs=output_text)
|
| 750 |
# ============================
|
| 751 |
|
| 752 |
# -------------------------------------------------------
|