Spaces:
Running
Running
| import gradio as gr | |
| from modules.dollar_cost_averaging import dollar_cost_averaging | |
| examples = [ | |
| ["AAPL", 200, 9000, 560, 20000] | |
| ] | |
| # Define the inputs | |
| stock_code = gr.Textbox(label="Stock Code", value="368590") | |
| first_purchase = gr.Markdown("<h3 class='h3_title'>FIRST PURCHASE</h3>") | |
| old_price = gr.Number(label="Old Price", value=18153) | |
| old_quantity = gr.Number(label="Quantity", value=122) | |
| second_purchase = gr.Markdown("<h3 class='h3_title'>SECOND PURCHASE</h3>") | |
| new_quantity = gr.Number(label="Quantity", value=1) | |
| input = [stock_code, old_price, old_quantity, new_quantity] | |
| output = gr.HTML() | |
| component_rows = [stock_code, first_purchase, old_price, old_quantity, second_purchase, new_quantity] | |
| # Define the update function | |
| def update_output(*args): | |
| return dollar_cost_averaging(*args) | |