Spaces:
Runtime error

File size: 928 Bytes
db492e3
 
f10da6e
db492e3
f10da6e
 
db492e3
f10da6e
 
 
 
 
db492e3
f10da6e
db492e3
f10da6e
 
 
 
 
 
 
 
 
 
 
 
db492e3
 
f10da6e
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
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()