jadehardouin commited on
Commit
3899805
·
1 Parent(s): a42de63

Update models.py

Browse files
Files changed (1) hide show
  1. models.py +10 -9
models.py CHANGED
@@ -96,15 +96,6 @@ class OpenAIModelGPT3_5(BaseTCOModel):
96
  super().__init__()
97
 
98
  def render(self):
99
- def define_cost_per_token(context_length):
100
- if context_length == "4K":
101
- cost_per_1k_input_tokens = 0.0015
102
- cost_per_1k_output_tokens = 0.002
103
- else:
104
- cost_per_1k_input_tokens = 0.003
105
- cost_per_1k_output_tokens = 0.004
106
- return cost_per_1k_input_tokens, cost_per_1k_output_tokens
107
-
108
  self.context_length = gr.Dropdown(choices=["4K", "16K"], value="4K", interactive=True,
109
  label="Context size",
110
  visible=False, info="Number of tokens the model considers when processing text")
@@ -117,6 +108,16 @@ class OpenAIModelGPT3_5(BaseTCOModel):
117
  interactive=False
118
  )
119
  self.info = gr.Markdown("The cost per input and output tokens values are from OpenAI's [pricing web page](https://openai.com/pricing)", interactive=False, visible=False)
 
 
 
 
 
 
 
 
 
 
120
  self.context_length.change(define_cost_per_token, inputs=self.context_length, outputs=[self.input_tokens_cost_per_token, self.output_tokens_cost_per_token])
121
 
122
  self.labor = gr.Number(0, visible=False,
 
96
  super().__init__()
97
 
98
  def render(self):
 
 
 
 
 
 
 
 
 
99
  self.context_length = gr.Dropdown(choices=["4K", "16K"], value="4K", interactive=True,
100
  label="Context size",
101
  visible=False, info="Number of tokens the model considers when processing text")
 
108
  interactive=False
109
  )
110
  self.info = gr.Markdown("The cost per input and output tokens values are from OpenAI's [pricing web page](https://openai.com/pricing)", interactive=False, visible=False)
111
+
112
+ def define_cost_per_token(context_length):
113
+ if context_length == "4K":
114
+ cost_per_1k_input_tokens = 0.0015
115
+ cost_per_1k_output_tokens = 0.002
116
+ else:
117
+ cost_per_1k_input_tokens = 0.003
118
+ cost_per_1k_output_tokens = 0.004
119
+ return cost_per_1k_input_tokens, cost_per_1k_output_tokens
120
+
121
  self.context_length.change(define_cost_per_token, inputs=self.context_length, outputs=[self.input_tokens_cost_per_token, self.output_tokens_cost_per_token])
122
 
123
  self.labor = gr.Number(0, visible=False,