Update app.py
Browse files
app.py
CHANGED
@@ -218,22 +218,23 @@ with gr.Blocks(title="Cloud Cost Estimator", theme=gr.themes.Soft(primary_hue="i
|
|
218 |
out_html = gr.HTML()
|
219 |
out_plot = gr.Plot()
|
220 |
|
221 |
-
#
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
api_calls.value, model_size.value, storage_gb.value,
|
226 |
-
reserved_instances.value, spot_instances.value, multi_year_commitment.value
|
227 |
-
)
|
228 |
-
return html, plot
|
229 |
|
230 |
-
# Initial calculation
|
231 |
-
demo.load(
|
232 |
|
233 |
-
#
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
|
|
|
|
|
|
|
|
|
|
238 |
|
239 |
demo.launch()
|
|
|
218 |
out_html = gr.HTML()
|
219 |
out_plot = gr.Plot()
|
220 |
|
221 |
+
# Create inputs list for the function
|
222 |
+
inputs = [compute_hours, tokens_per_month, input_ratio, api_calls,
|
223 |
+
model_size, storage_gb, reserved_instances, spot_instances, multi_year_commitment]
|
224 |
+
outputs = [out_html, out_plot]
|
|
|
|
|
|
|
|
|
225 |
|
226 |
+
# Initial calculation on load
|
227 |
+
demo.load(generate_cost_comparison, inputs, outputs)
|
228 |
|
229 |
+
# Update on each input change
|
230 |
+
compute_hours.change(generate_cost_comparison, inputs, outputs)
|
231 |
+
tokens_per_month.change(generate_cost_comparison, inputs, outputs)
|
232 |
+
input_ratio.change(generate_cost_comparison, inputs, outputs)
|
233 |
+
api_calls.change(generate_cost_comparison, inputs, outputs)
|
234 |
+
model_size.change(generate_cost_comparison, inputs, outputs)
|
235 |
+
storage_gb.change(generate_cost_comparison, inputs, outputs)
|
236 |
+
reserved_instances.change(generate_cost_comparison, inputs, outputs)
|
237 |
+
spot_instances.change(generate_cost_comparison, inputs, outputs)
|
238 |
+
multi_year_commitment.change(generate_cost_comparison, inputs, outputs)
|
239 |
|
240 |
demo.launch()
|