Spaces:
Running
Running
jadehardouin
commited on
Commit
β’
01f5691
1
Parent(s):
42b592e
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ import matplotlib.pyplot as plt
|
|
7 |
text = "<h1 style='text-align: center; color: #333333; font-size: 40px;'>TCO Comparison Calculator"
|
8 |
text2 = "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 |
description=f"""
|
10 |
-
<p>In this demo application, we help you compare different AI model services, such as Open source or SaaS 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 |
<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>
|
13 |
"""
|
@@ -77,23 +77,23 @@ def create_table(tco1, tco2, labor_cost1, labor_cost2, dropdown, dropdown2, late
|
|
77 |
def compute_cost_per_request(*args):
|
78 |
dropdown_id = args[-2]
|
79 |
dropdown_id2 = args[-1]
|
80 |
-
|
|
|
|
|
81 |
# Separate the arguments for page1 and page2
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
85 |
# Compute and compare using both pages
|
86 |
result_page1 = page1.compute_cost_per_token(*args_page1)
|
87 |
result_page2 = page2.compute_cost_per_token(*args_page2)
|
88 |
# Unpack the results from the functions
|
89 |
tco1, latency, labor_cost1 = result_page1
|
90 |
-
tco2, latency2, labor_cost2 = result_page2
|
91 |
-
|
92 |
return tco1, latency, labor_cost1, tco2, latency2, labor_cost2
|
93 |
else:
|
94 |
raise gr.Error("Please select two AI service options.")
|
95 |
-
|
96 |
-
|
97 |
|
98 |
def update_plot(tco1, tco2, dropdown, dropdown2, labour_cost1, labour_cost2):
|
99 |
|
|
|
7 |
text = "<h1 style='text-align: center; color: #333333; font-size: 40px;'>TCO Comparison Calculator"
|
8 |
text2 = "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 |
description=f"""
|
10 |
+
<p>In this demo application, we help you compare different AI model services, such as Open source or SaaS solutions, based on the Total Cost of Ownership (TOC) 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 |
<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>
|
13 |
"""
|
|
|
77 |
def compute_cost_per_request(*args):
|
78 |
dropdown_id = args[-2]
|
79 |
dropdown_id2 = args[-1]
|
80 |
+
print("Dropdown 1 value:", dropdown_id)
|
81 |
+
print("Dropdown 2 value:", dropdown_id2)
|
82 |
+
if dropdown_id!="" and dropdown_id2!="":
|
83 |
# Separate the arguments for page1 and page2
|
84 |
+
args_page1 = list(args) + [dropdown_id, input_tokens, output_tokens]
|
85 |
+
args_page2 = list(args) + [dropdown_id2, input_tokens, output_tokens]
|
86 |
+
print("Args for Page 1:", args_page1)
|
87 |
+
print("Args for Page 2:", args_page2)
|
88 |
# Compute and compare using both pages
|
89 |
result_page1 = page1.compute_cost_per_token(*args_page1)
|
90 |
result_page2 = page2.compute_cost_per_token(*args_page2)
|
91 |
# Unpack the results from the functions
|
92 |
tco1, latency, labor_cost1 = result_page1
|
93 |
+
tco2, latency2, labor_cost2 = result_page2
|
|
|
94 |
return tco1, latency, labor_cost1, tco2, latency2, labor_cost2
|
95 |
else:
|
96 |
raise gr.Error("Please select two AI service options.")
|
|
|
|
|
97 |
|
98 |
def update_plot(tco1, tco2, dropdown, dropdown2, labour_cost1, labour_cost2):
|
99 |
|