jadehardouin commited on
Commit
437efc5
1 Parent(s): 4ff2b6d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -92,20 +92,20 @@ description=f"""
92
  <p>In this demo application, we help you compare different solutions for your AI incorporation plans, such as open-source or SaaS.</p>
93
  <p>First, you'll have to choose the two solutions you'd like to compare. Then, follow the instructions to select your configurations for each solution and we will compute the cost/request accordingly to them. Eventually, you can compare both solutions to evaluate which one best suits your needs, in the short or long term.</p>
94
  """
95
- description1=f"""
96
- <p>This interface provides you with the cost per request you get using the open-source solution, based on the model you choose to use and how long you're planning to use it.</p>
97
- <p>The selected prices for a Virtual Machine rental come from Azure's VM rental plans, which can offer reductions for long-term reserved usage.</p>
98
- <p>To compute this cost per requets, some adjustments were chosen: the VM is an A100 40GB, supposedly maxed out at 80% and utilized 50% of the time in a full day. Plus, the number of tokens per request was set to 64.</p>
99
- <p>To see the formula used to compute the cost/request, check the box just below!</p>
100
- """
101
- description2=f"""
102
- <p>This interface provides you with the cost per request resulting from the AI model provider you choose and the number of tokens you select for context, which the model will take into account when processing input texts.</p>
103
- <p>To compute this cost per request, some adjustments were chosen: the number of tokens per request was set to 64.</p>
104
- <p>To see the formula used to compute the cost/request, check the box just below!</p>
105
- """
106
- description3=f"""
107
- <p>This interface compares the cost per request for the two solutions you selected and gives you an insight of whether a solution is more valuable in the long term.</p>
108
- """
109
 
110
  models = ["Llama-2-7B", "Llama-2-13B", "Llama-2-70B"]
111
  vm_rental_choice = ["pay as you go", "1 year reserved", "3 years reserved"]
@@ -226,7 +226,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
226
  gr.Markdown(text3)
227
 
228
  with gr.Row():
229
- plot = gr.BarPlot(title="Comparison", x_title="Solution", y_title="Cost/token ($)", interactive=True, width=500)
230
  if solution_selection=="Open-source":
231
  context_inp2.change(fn=update_plot, inputs=[out_diy, out_saas2], outputs=plot)
232
  model_provider_inp2.change(fn=update_plot, inputs=[out_diy, out_saas2], outputs=plot)
 
92
  <p>In this demo application, we help you compare different solutions for your AI incorporation plans, such as open-source or SaaS.</p>
93
  <p>First, you'll have to choose the two solutions you'd like to compare. Then, follow the instructions to select your configurations for each solution and we will compute the cost/request accordingly to them. Eventually, you can compare both solutions to evaluate which one best suits your needs, in the short or long term.</p>
94
  """
95
+ description1_intro="This interface provides you with the cost per token you get using the open-source solution, based on the model you choose to use and how long you're planning to use it. The selected prices for a Virtual Machine rental come from Azure's VM rental plans, which can offer reductions for long-term reserved usage."
96
+
97
+ description2_intro="This interface provides you with the cost per token resulting from the AI model provider you choose and the number of tokens you select for context, which the model will take into account when processing input texts."
98
+ description3="This interface compares the cost per request for the two solutions you selected and gives you an insight of whether a solution is more valuable in the long term."
99
+
100
+ latex_formula = r"$ saas\_cost\_per\_request = saas\_cost\_per\_token \times tokens\_per\_request$"
101
+ latex_formula2 = r"$ open\-source\_cost\_per\_request = \frac{tokens\_per\_request \times VM\_cost\_per\_hour \times (1 - reduction)}{tokens\_per\_second \times 3600 \times maxed\_out \times used}$"
102
+
103
+ tooltip_html = "<span style='color: blue; cursor: help;' title='The formula used for computations is here:{latex_formula}'>Hover here to see formula</span>"
104
+ tooltip_html2 = "<span style='color: blue; cursor: help;' title='The formula used for computations is here:{latex_formula2} with a VM A100 40GB, supposedly maxed out at 80% and utilized 50% of the day'>Hover here to see formula</span>"
105
+
106
+ description1 = f"{description1_intro} {tooltip_html2}"
107
+ description2 = f"{description2_intro} {tooltip_html}"
108
+
109
 
110
  models = ["Llama-2-7B", "Llama-2-13B", "Llama-2-70B"]
111
  vm_rental_choice = ["pay as you go", "1 year reserved", "3 years reserved"]
 
226
  gr.Markdown(text3)
227
 
228
  with gr.Row():
229
+ plot = gr.BarPlot(title="Comparison", y_title="Cost/token ($)", interactive=True, width=500)
230
  if solution_selection=="Open-source":
231
  context_inp2.change(fn=update_plot, inputs=[out_diy, out_saas2], outputs=plot)
232
  model_provider_inp2.change(fn=update_plot, inputs=[out_diy, out_saas2], outputs=plot)