m-ric HF staff commited on
Commit
1a65c20
1 Parent(s): 9ae565a

Fix factor thousand

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -71,15 +71,15 @@ def update_model_list(function_calling, litellm_provider, max_price, supports_vi
71
  list_models = filtered_models['model'].tolist()
72
  return gr.Dropdown(choices=list_models, value=list_models[0] if list_models else "No model found for this combination!")
73
 
74
- def compute_all(input_type, prompt_text, completion_text, prompt_tokens, completion_tokens, models):
75
  results = []
76
  for model in models:
77
  if input_type == "Text Input":
78
  prompt_tokens = count_string_tokens(prompt_text, model)
79
  completion_tokens = count_string_tokens(completion_text, model)
80
  else: # Token Count Input
81
- prompt_tokens = int(prompt_tokens * 1000)
82
- completion_tokens = int(completion_tokens * 1000)
83
 
84
  model_data = TOKEN_COSTS[TOKEN_COSTS['model'] == model].iloc[0]
85
  prompt_cost, completion_cost = calculate_total_cost(prompt_tokens, completion_tokens, model)
@@ -177,8 +177,8 @@ with gr.Blocks(css="""
177
  completion_text = gr.Textbox(label="Completion", value="Certainly: Why did the neural network go to therapy? It had too many deep issues!", lines=3)
178
 
179
  with gr.Group(visible=False) as token_input_group:
180
- prompt_tokens_input = gr.Number(label="Prompt Tokens (thousands)", value=1.5)
181
- completion_tokens_input = gr.Number(label="Completion Tokens (thousands)", value=2)
182
 
183
  with gr.Column():
184
  gr.Markdown("## Model choice:")
@@ -187,7 +187,7 @@ with gr.Blocks(css="""
187
  function_calling = gr.Checkbox(label="Supports Tool Calling", value=False)
188
  supports_vision = gr.Checkbox(label="Supports Vision", value=False)
189
  with gr.Column():
190
- supports_max_input_tokens = gr.Slider(label="Min Supported Input Length (thousands)", minimum=2, maximum=256, step=2, value=2)
191
  max_price = gr.Slider(label="Max Price per Input Token", minimum=0, maximum=0.001, step=0.00001, value=0.001, visible=False, interactive=False)
192
  litellm_provider = gr.Dropdown(label="Inference Provider", choices=["Any"] + TOKEN_COSTS['litellm_provider'].unique().tolist(), value="Any")
193
 
 
71
  list_models = filtered_models['model'].tolist()
72
  return gr.Dropdown(choices=list_models, value=list_models[0] if list_models else "No model found for this combination!")
73
 
74
+ def compute_all(input_type, prompt_text, completion_text, base_prompt_tokens, base_completion_tokens, models):
75
  results = []
76
  for model in models:
77
  if input_type == "Text Input":
78
  prompt_tokens = count_string_tokens(prompt_text, model)
79
  completion_tokens = count_string_tokens(completion_text, model)
80
  else: # Token Count Input
81
+ prompt_tokens = int(base_prompt_tokens)
82
+ completion_tokens = int(base_completion_tokens)
83
 
84
  model_data = TOKEN_COSTS[TOKEN_COSTS['model'] == model].iloc[0]
85
  prompt_cost, completion_cost = calculate_total_cost(prompt_tokens, completion_tokens, model)
 
177
  completion_text = gr.Textbox(label="Completion", value="Certainly: Why did the neural network go to therapy? It had too many deep issues!", lines=3)
178
 
179
  with gr.Group(visible=False) as token_input_group:
180
+ prompt_tokens_input = gr.Number(label="Prompt Tokens", value=1500)
181
+ completion_tokens_input = gr.Number(label="Completion Tokens", value=2000)
182
 
183
  with gr.Column():
184
  gr.Markdown("## Model choice:")
 
187
  function_calling = gr.Checkbox(label="Supports Tool Calling", value=False)
188
  supports_vision = gr.Checkbox(label="Supports Vision", value=False)
189
  with gr.Column():
190
+ supports_max_input_tokens = gr.Slider(label="Min Supported Input Length (thousands tokens)", minimum=2, maximum=256, step=2, value=2)
191
  max_price = gr.Slider(label="Max Price per Input Token", minimum=0, maximum=0.001, step=0.00001, value=0.001, visible=False, interactive=False)
192
  litellm_provider = gr.Dropdown(label="Inference Provider", choices=["Any"] + TOKEN_COSTS['litellm_provider'].unique().tolist(), value="Any")
193