Spaces:
Sleeping
Sleeping
File size: 3,446 Bytes
90d5657 2f115f4 90d5657 5366c37 ec5fad9 adb885b 2f115f4 adb885b 90d5657 5366c37 adb885b ec5fad9 90d5657 5366c37 adb885b 90d5657 5366c37 ec5fad9 4cb4597 5366c37 ec5fad9 2f115f4 5366c37 ec5fad9 5366c37 4cb4597 ec5fad9 90d5657 5366c37 2f115f4 adb885b ec5fad9 2f115f4 4cb4597 ec5fad9 2f115f4 90d5657 5366c37 4cb4597 ec5fad9 adb885b ec5fad9 5366c37 2f115f4 ec5fad9 4cb4597 adb885b 4cb4597 90d5657 5366c37 90d5657 ec5fad9 90d5657 adb885b 90d5657 adb885b 90d5657 2f115f4 4cb4597 ec5fad9 2f115f4 90d5657 ec5fad9 90d5657 adb885b 2f115f4 5366c37 2f115f4 90d5657 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
import gradio as gr
import matplotlib.pyplot as plt
# Helper function to format INR values
def format_rupees(value):
inr = f"₹ {value:,.2f}"
if value >= 1e7:
cr = f" (₹ {value / 1e7:.2f} Cr)"
return inr + cr
return inr
def cmda_redevelopment_final_model(
uds, num_owners, total_fsi, guideline_value, market_rate, construction_cost
):
owner_fsi = 2.0
premium_fsi = total_fsi - owner_fsi
# Area calculations
owner_total_area = owner_fsi * uds
builder_area = premium_fsi * uds
total_built_up_area = total_fsi * uds
# Premium FSI Charges
premium_fsi_charge = 0.4 * guideline_value * uds * premium_fsi
# Construction cost for entire built-up area
total_construction_cost = total_built_up_area * construction_cost
# Builder Revenue
builder_sale_value = builder_area * market_rate
# Builder Profit
builder_profit = builder_sale_value - total_construction_cost - premium_fsi_charge
# Owner share
uds_per_owner = uds / num_owners
owner_area_per_owner = owner_total_area / num_owners
# Chart
fig, ax = plt.subplots(figsize=(6, 4))
labels = ['Owner Area (2.0x UDS)', f'Builder Area ({premium_fsi:.1f}x UDS)', 'Total Area']
values = [owner_total_area, builder_area, total_built_up_area]
ax.bar(labels, values, edgecolor='black')
ax.set_ylabel("Area (sq.ft)")
ax.set_title("Redevelopment Share Breakdown")
plt.tight_layout()
# Output with formatted rupees
result = {
"Total UDS": f"{uds:.2f} sq.ft",
"Total Built-up Area (FSI × UDS)": f"{total_built_up_area:.2f} sq.ft",
"Owner Entitlement Area (2.0 × UDS)": f"{owner_total_area:.2f} sq.ft",
f"Builder Saleable Area ({premium_fsi:.1f} × UDS)": f"{builder_area:.2f} sq.ft",
"--- Builder Financials ---": "",
"Premium FSI Charges (0.4 × guideline × UDS × extra FSI)": format_rupees(premium_fsi_charge),
"Total Construction Cost (entire built-up area)": format_rupees(total_construction_cost),
"Builder Revenue (@ market rate)": format_rupees(builder_sale_value),
"Estimated Builder Profit": format_rupees(builder_profit),
"--- Owner Breakdown ---": "",
"Number of Owners": num_owners,
"UDS per Owner": f"{uds_per_owner:.2f} sq.ft",
"New Flat per Owner (2.0 × UDS)": f"{owner_area_per_owner:.2f} sq.ft"
}
return result, fig
# Gradio Interface
inputs = [
gr.Number(label="Total UDS (in sq.ft)", value=450),
gr.Number(label="Number of Owners", value=4),
gr.Number(label="Total FSI (e.g., 2.8)", value=2.8, minimum=2.0, maximum=3.5, step=0.1),
gr.Number(label="Guideline Value (₹/sq.ft)", value=5000),
gr.Number(label="Market Rate (₹/sq.ft for builder sale)", value=9500),
gr.Number(label="Construction Cost (₹/sq.ft)", value=3500),
]
outputs = [
gr.JSON(label="CMDA Redevelopment Report"),
gr.Plot(label="Redevelopment Share Chart")
]
app = gr.Interface(
fn=cmda_redevelopment_final_model,
inputs=inputs,
outputs=outputs,
title="CMDA Redevelopment Calculator (Fixed Owner FSI Model)",
description=(
"Owners receive flats at 2.0× their UDS. Builder gets only the premium FSI share, sells at market rate, "
"and bears full construction cost and premium FSI charges. Figures over ₹1 Cr are shown in crores."
)
)
if __name__ == "__main__":
app.launch()
|