m-ric HF staff commited on
Commit
7306a42
1 Parent(s): f152bca

Remove tokencost

Browse files
Files changed (3) hide show
  1. app.py +6 -2
  2. model_prices.json +0 -0
  3. requirements.txt +1 -1
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import gradio as gr
2
- from tokencost import count_message_tokens, count_string_tokens, calculate_prompt_cost, calculate_completion_cost
3
 
 
4
 
5
  def compute_all(prompt_string, completion_string, model):
6
  prompt_cost = calculate_prompt_cost(prompt_string, model)
@@ -13,9 +14,12 @@ def compute_all(prompt_string, completion_string, model):
13
 
14
 
15
  with gr.Blocks(theme='soft') as demo:
 
 
 
16
  with gr.Row():
17
  with gr.Column():
18
- prompt = gr.Textbox(value="Hello world")
19
  completion = gr.Textbox(value="...")
20
 
21
  model = gr.Dropdown(value="gpt-3.5-turbo", choices=["gpt-3.5-turbo", "gpt-3.5-turbo"])
 
1
  import gradio as gr
2
+ import pandas as pd
3
 
4
+ model_data = pd.read_json("model_prices.json")
5
 
6
  def compute_all(prompt_string, completion_string, model):
7
  prompt_cost = calculate_prompt_cost(prompt_string, model)
 
14
 
15
 
16
  with gr.Blocks(theme='soft') as demo:
17
+ gr.Markdown("""### Text-to-$: calculate the price of your LLM runs
18
+ Based on data from the great [tokencost](https://github.com/AgentOps-AI/tokencost/blob/main/tokencost/model_prices.json).
19
+ """)
20
  with gr.Row():
21
  with gr.Column():
22
+ prompt = gr.Textbox(value="Lorem ipsum dolor sit amet...")
23
  completion = gr.Textbox(value="...")
24
 
25
  model = gr.Dropdown(value="gpt-3.5-turbo", choices=["gpt-3.5-turbo", "gpt-3.5-turbo"])
model_prices.json ADDED
The diff for this file is too large to render. See raw diff
 
requirements.txt CHANGED
@@ -1 +1 @@
1
- tokencost
 
1
+ pandas