import gradio as gr
from modules.dollar_cost_averaging import dollar_cost_averaging
examples = [
[1000, 9000, 560, 20000]
]
# Define the inputs
title = gr.Markdown("
Dollar Cost Averaging Calculator
")
first_purchase = gr.Markdown("FIRST PURCHASE
")
old_price = gr.Number(label="Old Price", value=18150)
old_quantity = gr.Number(label="Quantity", value=95)
second_purchase = gr.Markdown("SECOND PURCHASE
")
new_price = gr.Number(label="New Price", value=17705)
new_quantity = gr.Number(label="Quantity", value=0)
input = [old_price, old_quantity, new_price, new_quantity]
output = gr.HTML()
component_rows= [first_purchase, old_price, old_quantity, second_purchase, new_price, new_quantity]
# Define the update function
def update_output(*args):
return dollar_cost_averaging(*args)