import gradio as gr def calculate_dcf(fcf_per_share, years, growth_rate_percent, discount_rate_percent): growth_rate = growth_rate_percent / 100 discount_rate = discount_rate_percent / 100 A = fcf_per_share * (1 + growth_rate) * (1 - (1 + growth_rate) ** years / (1 + discount_rate) ** years) B = discount_rate - growth_rate result = A / B return result iface = gr.Interface( fn=calculate_dcf, inputs=[ gr.inputs.Number(label="FCF per Share"), gr.inputs.Number(label="Years"), gr.inputs.Slider(minimum=0, maximum=100, label="Growth Rate (%)"), gr.inputs.Slider(minimum=0, maximum=100, label="Discount Rate (%)"), ], outputs="number", title="Discounted Cash Flow (DCF) Calculator", description="Calculate the Discounted Cash Flow (DCF) using the given inputs.", ) iface.launch()