Spaces:
Running
Running
jadehardouin
commited on
Commit
β’
91453e3
1
Parent(s):
a1e8f0e
Update app.py
Browse files
app.py
CHANGED
@@ -4,10 +4,13 @@ import results
|
|
4 |
import theme
|
5 |
|
6 |
text = "<h1 style='text-align: center; color: #333333; font-size: 40px;'>AI TCO Comparison Calculator"
|
7 |
-
text2 = "
|
8 |
-
|
9 |
-
|
10 |
-
<p>
|
|
|
|
|
|
|
11 |
<p>If you want to <strong>contribute to the calculator</strong> by adding your own AI service option, follow this <a href="https://huggingface.co/spaces/mithril-security/TCO_calculator/blob/main/How_to_contribute.md">tutorial</a> π. </p>
|
12 |
"""
|
13 |
formula = r"""
|
@@ -36,7 +39,8 @@ with gr.Blocks(theme=style) as demo:
|
|
36 |
Models: list[models.BaseTCOModel] = [models.OpenAIModelGPT4, models.OpenAIModelGPT3_5, models.CohereModel, models.DIYLlama2Model]
|
37 |
model_names = [Model().get_name() for Model in Models]
|
38 |
gr.Markdown(value=text)
|
39 |
-
gr.Markdown(value=
|
|
|
40 |
|
41 |
with gr.Row():
|
42 |
with gr.Column():
|
@@ -66,13 +70,13 @@ with gr.Blocks(theme=style) as demo:
|
|
66 |
|
67 |
shared_page1, shared_page2 = set_shared_data(page1, page2)
|
68 |
results.set_shared_pages(shared_page1, shared_page2)
|
69 |
-
|
70 |
dropdown.change(page1.make_model_visible, inputs=[dropdown, use_case], outputs=page1.get_all_components())
|
71 |
dropdown2.change(page2.make_model_visible, inputs=[dropdown2, use_case], outputs=page2.get_all_components())
|
72 |
|
73 |
compute_tco_btn = gr.Button("Compute & Compare", size="lg", variant="primary", scale=1)
|
74 |
tco1, tco2, labor_cost1, labor_cost2, latency, latency2 = [gr.State() for _ in range(6)]
|
75 |
-
|
76 |
with gr.Row():
|
77 |
with gr.Accordion("Click here to see the cost/request computation formula", open=False):
|
78 |
tco_formula = gr.Markdown(formula)
|
@@ -82,7 +86,7 @@ with gr.Blocks(theme=style) as demo:
|
|
82 |
with gr.Row():
|
83 |
table = gr.Markdown()
|
84 |
with gr.Row():
|
85 |
-
info = gr.Markdown(
|
86 |
with gr.Row():
|
87 |
with gr.Column(scale=1):
|
88 |
image = gr.Image(visible=False)
|
|
|
4 |
import theme
|
5 |
|
6 |
text = "<h1 style='text-align: center; color: #333333; font-size: 40px;'>AI TCO Comparison Calculator"
|
7 |
+
text2 = "<h1 style='color: #333333; font-size: 20px;'>π Want to contribute?"
|
8 |
+
text3 = "Please note that the cost/request only defines the infrastructure cost for deployment. The labor cost must be added for the whole AI model service deployment TCO."
|
9 |
+
intro = f"""
|
10 |
+
<p>In this demo application, we help you compare different AI model services, such as SaaS or "Deploy yourself" solutions, based on the Total Cost of Ownership for their deployment. π</p>
|
11 |
+
<p>Please note that we focus on getting the service up and running, but not the maintenance that follows.π</p>
|
12 |
+
"""
|
13 |
+
contribution = f"""
|
14 |
<p>If you want to <strong>contribute to the calculator</strong> by adding your own AI service option, follow this <a href="https://huggingface.co/spaces/mithril-security/TCO_calculator/blob/main/How_to_contribute.md">tutorial</a> π. </p>
|
15 |
"""
|
16 |
formula = r"""
|
|
|
39 |
Models: list[models.BaseTCOModel] = [models.OpenAIModelGPT4, models.OpenAIModelGPT3_5, models.CohereModel, models.DIYLlama2Model]
|
40 |
model_names = [Model().get_name() for Model in Models]
|
41 |
gr.Markdown(value=text)
|
42 |
+
gr.Markdown(value=intro + text2)
|
43 |
+
gr.Markdown(value=contribution)
|
44 |
|
45 |
with gr.Row():
|
46 |
with gr.Column():
|
|
|
70 |
|
71 |
shared_page1, shared_page2 = set_shared_data(page1, page2)
|
72 |
results.set_shared_pages(shared_page1, shared_page2)
|
73 |
+
|
74 |
dropdown.change(page1.make_model_visible, inputs=[dropdown, use_case], outputs=page1.get_all_components())
|
75 |
dropdown2.change(page2.make_model_visible, inputs=[dropdown2, use_case], outputs=page2.get_all_components())
|
76 |
|
77 |
compute_tco_btn = gr.Button("Compute & Compare", size="lg", variant="primary", scale=1)
|
78 |
tco1, tco2, labor_cost1, labor_cost2, latency, latency2 = [gr.State() for _ in range(6)]
|
79 |
+
|
80 |
with gr.Row():
|
81 |
with gr.Accordion("Click here to see the cost/request computation formula", open=False):
|
82 |
tco_formula = gr.Markdown(formula)
|
|
|
86 |
with gr.Row():
|
87 |
table = gr.Markdown()
|
88 |
with gr.Row():
|
89 |
+
info = gr.Markdown(text3)
|
90 |
with gr.Row():
|
91 |
with gr.Column(scale=1):
|
92 |
image = gr.Image(visible=False)
|