Spaces:
Runtime error

AzharAbbas's picture
Update app.py
f10da6e verified
Raw History Blame Contribute Delete
928 Bytes
import gradio as gr
import joblib
import numpy as np
# Load Model
model = joblib.load("model.pkl")
# Prediction Function
def predict(length, width, height, steel_rate, cement_rate, sand_rate):
features = np.array([[length, width, height, steel_rate, cement_rate, sand_rate]])
estimate = model.predict(features)[0]
return f"{estimate:,.2f} PKR"
# Gradio UI
iface = gr.Interface(
fn=predict,
inputs=[
gr.Number(label="Length (ft)"),
gr.Number(label="Width (ft)"),
gr.Number(label="Height (ft)"),
gr.Number(label="Steel Rate /kg"),
gr.Number(label="Cement Rate /bag"),
gr.Number(label="Sand Rate /cft"),
],
outputs=gr.Textbox(label="Estimated Construction Cost (PKR)"),
title="🏗️ Construction Estimate Calculator",
description="Enter building dimensions & material rates to get the cost estimate using an AI ANN model.",
)
iface.launch()