Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def calculate_dcf(fcf_per_share, years, growth_rate_percent, discount_rate_percent):
|
| 4 |
+
growth_rate = growth_rate_percent / 100
|
| 5 |
+
discount_rate = discount_rate_percent / 100
|
| 6 |
+
|
| 7 |
+
A = fcf_per_share * (1 + growth_rate) * (1 - (1 + growth_rate) ** years / (1 + discount_rate) ** years)
|
| 8 |
+
B = discount_rate - growth_rate
|
| 9 |
+
|
| 10 |
+
result = A / B
|
| 11 |
+
return result
|
| 12 |
+
|
| 13 |
+
iface = gr.Interface(
|
| 14 |
+
fn=calculate_dcf,
|
| 15 |
+
inputs=[
|
| 16 |
+
gr.inputs.Number(label="FCF per Share"),
|
| 17 |
+
gr.inputs.Number(label="Years"),
|
| 18 |
+
gr.inputs.Slider(minimum=0, maximum=100, label="Growth Rate (%)"),
|
| 19 |
+
gr.inputs.Slider(minimum=0, maximum=100, label="Discount Rate (%)"),
|
| 20 |
+
],
|
| 21 |
+
outputs="number",
|
| 22 |
+
title="Discounted Cash Flow (DCF) Calculator",
|
| 23 |
+
description="Calculate the Discounted Cash Flow (DCF) using the given inputs.",
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
iface.launch()
|