Spaces:
Runtime error
Runtime error
Download app.py from AzharAbbas/construction_estimate: direct link, hf CLI and curl.
- Browser
- Download file 928 Bytes
-
https://huggingface.co/spaces/AzharAbbas/construction_estimate/resolve/main/app.py
- Command line
-
hf download hf://spaces/AzharAbbas/construction_estimate/app.py
-
curl -L -o app.py https://huggingface.co/spaces/AzharAbbas/construction_estimate/resolve/main/app.py
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() | |