import gradio as gr from modules.retirement_planning import retirement_planning # Define examples for retirement planning examples = [ [38, 55, 85, 2000000, 3.0, 10000000, 500000, 0, True, 8, 8, 3.3, 3.3] ] # Define the input components title = gr.Markdown("<h2 style='margin: 5px'>Retirement Planning</h2>") title_profile = gr.Markdown("<h3 class='h3_title'>PROFILE</h3>") current_age = gr.Slider(label="Current Age (15-60 Years)", value=28, 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_savings = gr.Markdown("<h3 class='h3_title'>SAVINGS</h3>") monthly_income_required = gr.Number(label="Monthly Income Required (CPP)", value=2000000) inflation_rate = gr.Number(label="Inflation Rate (%)", value=3) current_investment = gr.Number(label="Current Investment", value=10000000) monthly_investment = gr.Number(label="Monthly Investment", value=500000) annual_increase_in_monthly_investment = gr.Number(label="Annual Increase in Monthly Investment", value=0) # 추가된 입력 reinvest_dividends = gr.Checkbox(label="Reinvest Dividends", value=True) title_growth = gr.Markdown("<h3 class='h3_title'>GROWTH</h3>") pre_retirement_roi = gr.Number(label="Return On Investment (Pre-retirement) (%)", value=8) post_retirement_roi = gr.Number(label="Return On Investment (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, current_investment, monthly_investment, annual_increase_in_monthly_investment, reinvest_dividends, pre_retirement_roi, post_retirement_roi, pre_retirement_dividend_yield, post_retirement_dividend_yield] output = gr.HTML() component_rows = [ current_age, retirement_age, life_expectancy,[monthly_income_required, inflation_rate], current_investment, monthly_investment, annual_increase_in_monthly_investment, [reinvest_dividends], [pre_retirement_roi, post_retirement_roi], [pre_retirement_dividend_yield, post_retirement_dividend_yield] ] # Define the update function def update_output(*args): return retirement_planning(*args)