Spaces:
Running
Running
jadehardouin
commited on
Commit
•
52a72f5
1
Parent(s):
9de3425
Update app.py
Browse files
app.py
CHANGED
@@ -2,10 +2,10 @@ import gradio as gr
|
|
2 |
import models
|
3 |
import time
|
4 |
|
5 |
-
text = "<h1 style='text-align: center; color:
|
6 |
-
text1 = "<h1 style='text-align: center; color:
|
7 |
-
text2 = "<h1 style='text-align: center; color:
|
8 |
-
text3 = "<h1 style='text-align: center; color:
|
9 |
description=f"""
|
10 |
<p>In this demo application, we help you compare different solutions for your AI incorporation plans, such as OpenSource or SaaS.</p>
|
11 |
<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/token accordingly to them. Eventually, both solutions are compared to evaluate which one best suits your needs.</p>
|
@@ -17,9 +17,9 @@ def compute_ratio(tco1, tco2):
|
|
17 |
r = tco1 / tco2
|
18 |
|
19 |
if r < 1:
|
20 |
-
comparison_result = f"
|
21 |
elif r > 1:
|
22 |
-
comparison_result = f"Second solution is
|
23 |
else:
|
24 |
comparison_result = "Both solutions will cost the same."
|
25 |
return comparison_result
|
@@ -28,7 +28,7 @@ def compute_ratio(tco1, tco2):
|
|
28 |
return f"Error: {str(e)}"
|
29 |
|
30 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
31 |
-
Models: list[models.BaseTCOModel] = [models.OpenAIModel, models.OpenSourceLlama2Model]
|
32 |
model_names = [Model().get_name() for Model in Models]
|
33 |
gr.Markdown(value=text)
|
34 |
gr.Markdown(value=description)
|
|
|
2 |
import models
|
3 |
import time
|
4 |
|
5 |
+
text = "<h1 style='text-align: center; color: midnightblue; font-size: 30px;'>TCO Comparison Calculator"
|
6 |
+
text1 = "<h1 style='text-align: center; color: midnightblue; font-size: 20px;'>First solution"
|
7 |
+
text2 = "<h1 style='text-align: center; color: midnightblue; font-size: 20px;'>Second solution"
|
8 |
+
text3 = "<h1 style='text-align: center; color: midnightblue; font-size: 20px;'>Compute and compare TCOs"
|
9 |
description=f"""
|
10 |
<p>In this demo application, we help you compare different solutions for your AI incorporation plans, such as OpenSource or SaaS.</p>
|
11 |
<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/token accordingly to them. Eventually, both solutions are compared to evaluate which one best suits your needs.</p>
|
|
|
17 |
r = tco1 / tco2
|
18 |
|
19 |
if r < 1:
|
20 |
+
comparison_result = f"Second solution is {1/r:.5f} times more expensive than the first"
|
21 |
elif r > 1:
|
22 |
+
comparison_result = f"Second solution is {r:.5f} times cheaper than the first"
|
23 |
else:
|
24 |
comparison_result = "Both solutions will cost the same."
|
25 |
return comparison_result
|
|
|
28 |
return f"Error: {str(e)}"
|
29 |
|
30 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
31 |
+
Models: list[models.BaseTCOModel] = [models.OpenAIModel, models.OpenSourceLlama2Model, models.CohereModel]
|
32 |
model_names = [Model().get_name() for Model in Models]
|
33 |
gr.Markdown(value=text)
|
34 |
gr.Markdown(value=description)
|