Spaces:
Running
Running
import gradio as gr | |
from modules.retirement_planning import retirement_planning | |
# Define examples for retirement planning | |
examples = [ | |
[20, 55, 85, 2000000, 3.0, 10000000, 1500000, 0, True, 8, 8, 3.3, 3.3] | |
] | |
# Define the input components | |
title_1 = gr.Markdown("<h3 class='h3_title'>Profile</h3>") | |
current_age = gr.Slider(label="Current Age (15-60 Years)", value=35, minimum=15, maximum=60, step=1) | |
retirement_age = gr.Slider(label="Retirement Age (Upto 70 Years)", value=55, minimum=15, maximum=70, step=1) | |
life_expectancy = gr.Slider(label="Life Expectancy (Upto 100 Years)", value=80, minimum=30, maximum=100, step=1) | |
title_2 = gr.Markdown("<h3 class='h3_title'>Contribution</h3>") | |
monthly_income_required = gr.Number(label="Current Monthly Expense", value=2000000) | |
inflation_rate = gr.Number(label="Inflation Rate (%)", value=3) | |
initial_investment = gr.Number(label="Initial Investment", value=10000000) | |
monthly_contribution = gr.Number(label="Monthly Contribution", value=1000000) | |
annual_increase_in_monthly_contribution = gr.Number(label="Annual Increase in Monthly Contribution", value=0) # ์ถ๊ฐ๋ ์ ๋ ฅ | |
reinvest_dividends = gr.Checkbox(label="Reinvest Dividends", value=True) | |
title_3 = gr.Markdown("<h3 class='h3_title'>Performance</h3>") | |
pre_retirement_dividend_growth = gr.Number(label="Dividend Growth (Pre-retirement) (%)", value=8) | |
post_retirement_dividend_growth = gr.Number(label="Dividend Growth (Post-retirement) (%)", value=8) | |
pre_retirement_dividend_yield = gr.Number(label="Dividend Yield (Pre-retirement) (%)", value=3.3) | |
post_retirement_dividend_yield = gr.Number(label="Dividend Yield (Post-retirement) (%)", value=3.3) | |
input = [current_age, retirement_age, life_expectancy, monthly_income_required, inflation_rate, initial_investment, monthly_contribution, annual_increase_in_monthly_contribution, reinvest_dividends, pre_retirement_dividend_growth, post_retirement_dividend_growth, pre_retirement_dividend_yield, post_retirement_dividend_yield] | |
output = gr.HTML() | |
component_rows = [ | |
[current_age, retirement_age, life_expectancy],[monthly_income_required, inflation_rate], | |
[initial_investment, monthly_contribution, annual_increase_in_monthly_contribution], [reinvest_dividends], | |
[pre_retirement_dividend_growth, post_retirement_dividend_growth], [pre_retirement_dividend_yield, post_retirement_dividend_yield] | |
] | |
# Define the update function | |
def update_output(*args): | |
return retirement_planning(*args) | |